IBM Support

IZ95943: INCORRECT OUTPUT WITH -O3 -Q64

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

  • compiling the following test case with -O3 -q64 in V11.1, code
    geneneration for pop_stack is not generated even though the
    conditions are met.
    
    The lines in questions are here:
    
       if (pushed)
          if ((ele != 0) && (ele) && (ele->flags & 0x2))
            stack_pop(ele, 0);      /* Expect a POP here */
    
    Adding printf statements between if (pushed) and stack_pop()
    call, the code gen is correct again.
    
    
    
    ===== TESTCASE:
    
    $cat t.c
    #include <stdio.h>
    #include <setjmp.h>
    
    typedef struct ele_t
    {
      unsigned int flags;
    } ele_t;
    
    int stack[64];
    int nstack;
    
    void stack_pop(ele_t *ele_p, int *xptr)
    {
      printf("stack_pop \n");
      nstack--;
      if (xptr)
        *xptr = stack[nstack];
    }
    
    void stack_push(ele_t *elep , int x)
    {
      printf("stack_push \n");
      stack[nstack] = x;
      nstack++;
    }
    
    void func(ele_t *ele)
    {
      int     some_flag;
      int     vfalse = 0;
      int     pushed = 0;
      jmp_buf buf;
    
      stack_push(ele, 1);                        /* PUSH */
      pushed = 1;
    
      if ((setjmp(buf)) == 0) ;
      else          /* block never reached for test case */
      {
        if (!(some_flag & (unsigned int) 0x8))
          some_flag |= (unsigned int) 0x8;
    
        if ((ele != 0) && (ele) && (ele->flags & 0x2))
          stack_pop(ele, 0);
      }
    
      if (vfalse)
      {
        if ((ele != 0) && (ele) && (ele->flags & 0x2))
          stack_pop(ele, &vfalse);
      }
      else
      {
        printf("line# %d is reachable, but not rest of block when
    compiled with -O3\n", __LINE__);
        if (pushed)
          if ((ele != 0) && (ele) && (ele->flags & 0x2))
            stack_pop(ele, 0);      /* Expect a POP here */
      }
    
      if ((ele != 0) && (ele) && (ele->flags & 0x2))
        do { { } } while(0);
    }
    
    int main()
    {
      ele_t ele = { 2 };;
      func(&ele);
    }
    
    
    
    
    
    
    ===== ACTUAL OUTPUT:
    
    
    $xlc -O3 -q64 t.c && ./a.out
    stack_push
    line# 54 is reachable, but not rest of block when compiled with
    -O3
    
    
    ===== EXPECTED OUTPUT:
    stack_push
    line# 54 is reachable, but not rest of block when compiled with
    -O3
    stack_pop
    

Local fix

  • Use -O2 -q64 or use -q32
    

Problem summary

  • PROBLEM DESCRIPTION: incorrect output from program optimized
    with O3
    
    USERS AFFECTED: all who use -O3
    

Problem conclusion

  • The problem is fixed. Apply recommended PTF level.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IZ95943

  • 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-03-02

  • 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:

    LI76265

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