IBM Support

LI77871: INCORRECT IF STATEMENT LOGIC WITH -O3

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • ERROR DESCRIPTION:Ø
    In a larger program,  the following statement fails with -O3
    when the "if" statement is coded:
     if (memcmp(rr->getLastName().getData(),"Brown",5) != 0)
       allBrown = false;
    
    But it works with -O3 if the "if" statement is coded:
     if (memcmp(rr->getLastName().getData(),"Brown",5) != 0) {
       allBrown = false;
       CPPUNIT_ASSERT (allBrown == true);  // or anything else on
    this line, "cout << ..."for example.
     }
    
    Somehow the "allBrown = false;" statement is executed even when
    the "if" condition is false when only a single statement
    follows the "if" with -O3.
    

Local fix

  • LOCAL FIX:Ø
    Change program source or use xlC 12.1.0.0.
    

Problem summary

  • PROBLEM DESCRIPTION: Incorrect code generation for IF
    statements using results of memcmp library function.
    
    USERS AFFECTED: Any using XLC/C++ with inlining enabled and -O2
    and up, with the code pattern described in the problem
    description.
    

Problem conclusion

  • Fixed an erroneous optimization of if statements using memcmp
    as the condition.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI77871

  • Reported component name

    XL C/C++ FOR BG

  • Reported component ID

    5799AG100

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2014-02-18

  • Closed date

    2014-02-18

  • Last modified date

    2014-02-18

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

    IV44027

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

Fix information

  • Fixed component name

    XL C/C++ FOR BG

  • Fixed component ID

    5799AG100

Applicable component levels

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SS2LWA","label":"XL C\/C++ for Blue Gene\/Q"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"12.1","Edition":"","Line of Business":{"code":"LOB73","label":"Power TPS"}}]

Document Information

Modified date:
05 September 2024