IBM Support

IZ72118: -QHOT OPTION CAUSING INCORRECT RESULT

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When compiling the following test case with -qhot=level=1 (level
    1 is implied when using -qhot), the 'if (!b && a)' statement is
    evaluating as true.
    
    
         ====== TEST CASE ======
    
    #include <stdio.h>
    
    long subr(long a, long b)
    
    {
      long i;
    
      for (i = 0; i < 1; i++) {
        printf (" 1:  b = %d  a = %d\n", b, a);
        if (!b && !a)
          printf (" 2:  b = %d  a = %d  !!! \n", b, a);
        if (!b && a)
          printf (" 3:  b = %d  a = %d  !!! \n", b, a);
      }
    
      return 0;
    }
    
    int main()
    
    {
      subr(0, 1);
      return 0;
    }
    

Local fix

  • Compile with the lower HOT level, -qhot=level=0.  Higher
    optimization levels such as -O4 and -O5 implicitly set
    level=1.  This option can be used to force level 0.
    

Problem summary

  • USERS AFFECTED:
    Any user of -qhot
    
    PROBLEM DESCRIPTION:
    Unswitching produces incorrect results when a predicate and its
    exact negation both occur within a loop region where one of
    them is unswitched.
    

Problem conclusion

  • After moving an if statement outside of a region, the old
    statement needs to be folded.  The problem was that the old
    statement (and others equivalent to it) were matched by value
    number.  However, the compiler failed to distinguish between
    if(expr) and if(!expr) and so folded both.  The correct
    behaviour is to only fold statements identical to the original
    statement that was unswitched.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ72118

  • Reported component name

    XLC C++ AIX

  • Reported component ID

    5724M1200

  • Reported release

    800

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-03-03

  • Closed date

    2010-03-29

  • Last modified date

    2010-03-29

Fix information

  • Fixed component name

    XLC AIX

  • Fixed component ID

    5724M1100

Applicable component levels

  • R800 PSY U833861

       UP C



Document information

More support for: XL C/C++
Compiler

Software version: 8.0

Reference #: IZ72118

Modified date: 29 March 2010


Translate this page: