IBM Support

IV05137: SEGMENTATION FAULT AT O3 WITHIN NESTED LOOP

Fixes are available

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/C++ for AIX, V11.1
October 2012 PTF for XL 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

  • A segmentation fault is encountered at -O3 optimization whe
    runnning a test case that contains a nested loop.
    
    ==== Test case:
    test.c:
    #include <stdlib.h>
    #include <stdio.h>
    
    typedef struct {
      void *params;
    } Temp;
    
    void * get_params(Lattice *lat)
    {
      return lat->params;
    }
    
    void get_loop(Temp *lat, int x[], int nd, int index)
    {
      void *p = get_params(lat);
    
      for(int i=0; i<nd; i++) {
        x[i] = index;
      }
    }
    
    void CreateNestedBlock(int nd, Lattice *lat)
    {
      for(int b=0; b<2; b++) {
       int xf[nd];
        for(int j=0; j<1; j++) {
          get_loop(lat, xf, nd, j);
        }
      }
    }
    
    int main(int argc, char *argv[])
    {
      int ndim = 4;
      Temp lat;
      lat.params = NULL;
    
      printf("starting\n");
      CreateNestedBlock(ndim, &lat);
      printf("done\n");
    
      return 0;
    }
    
    
    ==== Observed Output:
    $ xlc -O3 test.c
    staring
    Segmentation fault
    $
    

Local fix

  • Use a lower optimization level.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Segmentation fault at -O3 when returning from a function.
    
    USERS AFFECTED:
    Users of optimization levels -O3 or higher.
    

Problem conclusion

  • Intermediate generated code was incorrectly moved outside of an
    internal optimized loop. Resulting in the corruption of the
    return address of the function. This fix involves ensuring that
    this particular block of code is not moved outside of the loop.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV05137

  • 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

    2011-08-09

  • Closed date

    2011-08-09

  • Last modified date

    2011-08-10

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

    LI76071

  • 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:
28 September 2021