IBM Support

PH48129: INCORRECT OUTPUT WHEN -O2

A fix is available

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling the provided testcase with -O2, the resulting exe
    produces an incorrect output as showing below.
    
    ===== ACTUAL OUTPUT:
    $ xlC testprms.cpp prmparse.cpp -O2
    
    $./a.out
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0BB34, exprLen=8
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0BB3C, exprLen=15
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0BB43, exprLen=4
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0BB47, exprLen=11
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0BB4E, exprLen=7
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0BB55, exprLen=12
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0BB5A, exprLen=9
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0BB63, exprLen=14
    parm=2, exprVal=25C0BB3C, exprLen=15, textVal=25C0BB3C,
    textLen=6, data="LONDON,MDL=MODEL"
    parm=5, exprVal=25C0BB47, exprLen=11, textVal=25C0BB47,
    textLen=6, data="MODEL5,USERID=AB"
    parm=6, exprVal=25C0BB63, exprLen=14, textVal=25C0BB63,
    textLen=5, data="BAKER           "
    parm=7, exprVal=25C0BB55, exprLen=12, textVal=25C0BB55,
    textLen=4, data="ABLE,PASSWORD=BA"
    
    *** Error - incorrect behaviour was observed.
    $
    
    ===== EXPECTED OUTPUT:
    $ xlC testprms.cpp prmparse.cpp
    $./a.out
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0B6D4, exprLen=8
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0B6D4, exprLen=15
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0B6E3, exprLen=4
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0B6E3, exprLen=11
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0B6EE, exprLen=7
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0B6EE, exprLen=12
    Line 260: state=nameSearch
    Line 275: exprPtr=25C0B6FA, exprLen=9
    Line 260: state=valueSearch
    Line 275: exprPtr=25C0B6FA, exprLen=14
    parm=2, exprVal=25C0B6D4, exprLen=15, textVal=25C0B6DC,
    textLen=6, data="CLINODE=LONDON,M"
    parm=5, exprVal=25C0B6E3, exprLen=11, textVal=25C0B6E7,
    textLen=6, data="MDL=MODEL5,USERI"
    parm=6, exprVal=25C0B6FA, exprLen=14, textVal=25C0B703,
    textLen=5, data="PASSWORD=BAKER  "
    parm=7, exprVal=25C0B6EE, exprLen=12, textVal=25C0B6F5,
    textLen=4, data="USERID=ABLE,PASS"
    
    Correct behaviour was observed.
    $
    

Local fix

  • N/A
    

Problem summary

  • ****************************************************************
    * USERS AFFECTED: XLC Users using the OPTIMIZE option.         *
    ****************************************************************
    * PROBLEM DESCRIPTION: The optimizer may incorrectly optimize  *
    *                      a conditional statement to produce an   *
    *                      incorrect/undefined result when         *
    *                      assigning value to an undefined (but    *
    *                      declared) variable.                     *
    ****************************************************************
    * RECOMMENDATION: Install the PTF                              *
    ****************************************************************
    N/A
    

Problem conclusion

  • The user should install the PTF.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PH48129

  • Reported component name

    C/C++ FOR MVS

  • Reported component ID

    56551210A

  • Reported release

    7C0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2022-07-20

  • Closed date

    2022-08-05

  • Last modified date

    2022-10-03

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Modules/Macros

  • CCNECICS CCNECWI  CCNED240 CCNEDSCT CCNEDWRT CCNEFILT CCNEHIFC
    CCNEIPA3 CCNEIPAO CCNEMDEP CCNEOPTP CCNEP    CCNEPP   CCNETBY
    CCNMSGE  CCNMSGT  CCNQIPA
    

Fix information

  • Fixed component name

    C/C++ FOR MVS

  • Fixed component ID

    56551210A

Applicable component levels

  • R7C0 PSY UI81828

       UP22/09/07 P F209

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSTLTF","label":"z\/OS XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7C0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
03 October 2022