IBM Support

IZ78390: INCORRECT RESULT WITH -O2

Fixes are available

September 2010 PTF for XL C for AIX, V11.1
September 2010 PTF for XL C/C++ for AIX, V11.1
January 2011 PTF for XL C/C++ for AIX, V11.1
May 2011 PTF for XL C for AIX, V11.1
May 2011 PTF for XL C/C++ for AIX, V11.1
August 2011 PTF for XL C/C++ for AIX, V11.1
November 2011 PTF for XL C/C++ for AIX, V11.1
January 2012 PTF for XL C for AIX, V11.1
January 2012 PTF for XL C/C++ for AIX, V11.1
April 2012 PTF for XL C for AIX, V11.1
April 2012 PTF for XL C/C++ for AIX, V11.1
July 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C for AIX, V11.1
October 2012 PTF for XL C/C++ for AIX, V11.1
February 2013 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C/C++ for AIX, V11.1
XL C/C++ for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 22 (September 2015 PTF) for 11.1
XL C for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
July 2010 PTF for XL C/C++ for AIX, V11.1
July 2010 PTF for XL C for AIX, V11.1
January 2011 PTF for XL C for AIX, V11.1
August 2011 PTF for XL C for AIX, V11.1
November 2011 PTF for XL C for AIX, V11.1
July 2012 PTF for XL C for AIX, V11.1
XL C for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 22 (September 2015 PTF) for 11.1

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case produces incorrect result if compiled
    with -O2.
    
    
    ==========
    TEST CASE:
    ==========
    
    #include <stdio.h>
    int main()
         {
         double d = 1.0;
         short i;
         struct DBLM { double d;};
         union {
            struct DBLM a[2];
            struct { struct DBLM low, by; } s;
            } du;
         for(i=0;i<2;i++)
            du.a[i].d = d;
         if(du.s.by.d == 0)
            printf("ERROR: Should not get here! %g\n",du.s.by.d);
         return 0;
         }
    
    
    
    BAD:
    
    $xlc_r ./t.c -O2
    $./a.out
    ERROR: Should not get here! 0
    
    GOOD:
    xlc_r ./t.c
    $./a.out
    (prints out nothing)
    

Local fix

  • Use XL C/C++ for AIX release prior to V10.1.
    

Problem summary

  • PROBLEM DESCRIPTION: Incorrect result with -O2.  The compiler
    does not always alias array and nested struct members of an
    Union together.  This causes a correctness problem at
    Optimization.
    
    USERS AFFECTED: C only.  All platforms.  Nested array and
    struct members within a union.
    

Problem conclusion

  • The compiler now properly recognizing that an element of an
    array member and a member of a sub-struct member of a union
    overlap the same memory location. The problem is fixed.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ78390

  • Reported component name

    XL C FOR AIX

  • Reported component ID

    5724X1200

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-06-30

  • Closed date

    2010-06-30

  • Last modified date

    2010-06-30

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

    IZ74157

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

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5724X1200

Applicable component levels

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1"}]

Document Information

Modified date:
05 October 2021