IBM Support

IZ93220: INCORRECT OUTPUT WITH OPTIMIZATION TURNED ON

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

  • Incorrect output with optimization turned on at compile time
    using the following test program:
    
    /************************* test.c ***************************/
    #include <stdio.h>
    
    struct  MYSTRUCT {
      long af;
      long as;
    };
    
    void foo(struct MYSTRUCT *element,long second)
    {
    if (element->af != second) {
      printf("ERROR: element->af =%ld,second=%ld\n",element->af,
    second);
      printf("       They should be the same.\n");
      }
    else
      printf("SUCCESS: element->af and second are the same:
    %ld.\n",second);
    }
    
    void assgn(long i,double *d) {
      if (i == 1) *d=5.0;
      if (i == 2) *d=1.0;
      return;
    }
    
    int myfunc (struct MYSTRUCT *element)
    {
      long    first, second;
      double  temp;
      assgn (1, &temp);
      second = (long)temp;
      assgn (2, &temp);
      first = (long)temp;
      element->as = (int) first;
      element->af = second;   /* <<== Problem occurs here */
      foo(element,second);
      return(0);
    }
    
    int main() {
     struct MYSTRUCT foo;
      int rc;
      foo.af = 0L;
      rc = myfunc (&foo);
    }
    
    /********************* end of test.c **********************/
    
    
    Compiling to reproduce the error:
    
    $xlc -qnoinline -q64 -qarch=auto -O test.c
    $./a.out
    ERROR: element->af =1,second=5
           They should be the same.
    
    Testcase works as expected if optimization is not turned on:
    
    
    $xlc -qnoinline -q64 -qarch=auto test.c
    $./a.out
    SUCCESS: element->af and second are the same: 5.
    

Local fix

  • Do not turn on optimization.
    

Problem summary

  • Incorrect code generation for floating-point to integer
    conversion with -O2 and up, -qarch=pwr4 and up
    

Problem conclusion

  • Fixed optimization issue with floating-point to integer
    conversions for pwr4 and up.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ93220

  • Reported component name

    XL C++ RUNTIME

  • Reported component ID

    5724X1301

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2011-01-26

  • Closed date

    2011-03-08

  • Last modified date

    2011-03-08

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

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

    LI76134

Fix information

  • Fixed component name

    XL C FOR AIX

  • Fixed component ID

    5724X1200

Applicable component levels

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

Document Information

Modified date:
08 March 2011