IBM Support

IZ95269: INCORRECT OUTPUT WITH -O3 AND -QLIBANSI

Fixes are available

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
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 testcase produces incorrect output with "-O3
    -qlibansi":
    
    1. Testcase:
    
    /************ test.c ************/
    
    #include <stdio.h>
    
    void foo(void *ws) {
      *(int *)ws = 0;
    }
    
    int main()
    {
       int *            testInString;
       int *            testOutString;
       unsigned char    eq;
       testInString = (int *)malloc(6);
       testOutString = (int *)malloc(6);
       bzero(testInString,6);
       bzero(testOutString,6);
       memcpy(testInString,"HELLO",5);
       memcpy(testOutString,"HELLO",5);
       eq = (unsigned char)(!memcmp(testInString,testOutString,5));
       foo(testInString);
       if (!eq) printf("WRONG!!!! Should not print.\n");
       else printf("Correct!\n");
       return(1);
    
    }
    
    /******** end of test.c ***********/
    
    2. Compile with: xlc_r test.c -O3 -q64 -qlibansi
    
    3. Run:
    
    ./a.out
    
    
    Actual Output:
    
    WRONG!!!! Should not print.
    
    
    
    Expected output:
    
    Correct!
    

Local fix

  • 1. Lower optimization level from -O3 to -O2
    2. Do not use option -qlibansi
    

Problem summary

  • Incorrect code generation for memcmp operations with -O3 and
    -qlibansi
    

Problem conclusion

  • Fixed a case where memcmp calls could be optimized incorrectly
    with -qlibansi.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ95269

  • Reported component name

    XL C/C++ AIX

  • Reported component ID

    5724X1300

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-02-16

  • Closed date

    2011-04-20

  • Last modified date

    2011-04-20

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

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

    LI76282

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:
06 October 2021