IV44027: INCORRECT IF STATEMENT LOGIC WITH -O3

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

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

  • 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

    IV44027

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-06-10

  • Closed date

    2013-09-18

  • Last modified date

    2013-09-20

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

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

    LI77667 LI77871

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5725C7100

Applicable component levels

  • RC10 PSY U861595

       UP C



Rate this page:

(0 users)Average rating

Add comments

Document information


More support for:

XL C for AIX
Compiler

Software version:

12.1

Reference #:

IV44027

Modified date:

2013-09-20

Translate my page

Machine Translation

Content navigation