Fixes are available
July 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
December 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2012 PTF for XL C Enterprise Edition for AIX, V9.0
March 2012 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
July 2011 PTF for XL C Enterprise Edition for AIX, V9.0
December 2011 PTF for XL C Enterprise Edition for AIX, V9.0
APAR status
Closed as program error.
Error description
The following test case involves array calculations and produces an incorrect output for both C and C++ at -O and up. =========Compile Line: xlC -O test.cpp =========Test Case: $ cat test.cpp #include <stdio.h> static int interpolate_sol( /* double** sol, */ double *sol[], int nsl, int nsu, int nv, double* sg, double* xg, double* vg, double** solp, double* sgp, double* xgp, double* vgp ); static int interpolate_sol( /* double** sol, */ double *sol[], int nsl, int nsu, int nv, double* sg, double* xg, double* vg, double** solp, double* sgp, double* xgp, double* vgp ) { /* assume the interval vg is inside vgp */ int vj[ 1000 ]; int i, j, k, n; k = 1; for( j=0; j<nv; ++j) { while( vg[j] > vgp[k] ) ++k; vj[j] = k; } n = 1; for( i=nsl; i<nsu; ++i) { while( sg[i] > sgp[n] ) ++n; for( j=0; j<nv; ++j ) { k = vj[j]; /* grid point (i,j) in sg x vg is inside the rectangle (n-1,k-1) (n,k) in sgp x vgp */ /***/ sol[0][0] = /***/ (solp[n-1][k-1] * (sgp[n]-sg[i] )* (vgp[k]-vg[j]) + solp[n ][k-1] * (sg[i]- sgp[n-1])* (vgp[k]-vg[j]) + solp[n-1][k ] * (sgp[n]-sg[i] )* (vg[j]-vgp[k-1])+ solp[n ][k ] * (sg[i]- sgp[n-1])* (vg[j]-vgp[k-1]) ) /( (sgp[n]- sgp[n-1])* (vgp[k]-vgp[k-1])); if (j==0) fprintf(stderr,"sgp[%i] = %g \n",n, sgp[n]); } } /***for(i=0;i<100;i++) fprintf(stdout,"#sgp[%i] = %g \n",i, sgp[i]);***/ return 0; } int main() { double sg[100],vg[100],xg[100]; double sgp[100],vgp[100],xgp[100]; double *sol[100], *solp[100]; double soldata[100][100], solpdata[100][100]; int i,j; for (i=0; i<100; i++) { sg[i] = sgp[i] = xg[i] = xgp[i] = vg[i] = vgp[i] = i; sol[i] = &soldata[i][0]; solp[i] = &solpdata[i][0]; for (j=0; j<100; j++) { solp[i][j] = i+j; } } interpolate_sol( sol, 0, 100, 100, sg, xg, vg, solp, sgp, xgp, vgp ); /***for(i=0;i<100;i++) fprintf(stdout,"*sgp[%i] = %g \n",i, sgp[i]);***/ return 0; } $ ========Actual Output: $./a.out sgp[1] = 1 sgp[1] = 1 sgp[2] = 1 sgp[3] = 1 sgp[4] = 1 sgp[5] = 1 sgp[6] = 1 ... sgp[94] = 1 sgp[95] = 1 sgp[96] = 1 sgp[97] = 1 sgp[98] = 1 sgp[99] = 1 $ ========Expected Output: $./a.out sgp[1] = 1 sgp[1] = 1 sgp[2] = 2 sgp[3] = 3 sgp[4] = 4 sgp[5] = 5 sgp[6] = 6 sgp[7] = 7 sgp[8] = 8 sgp[9] = 9 sgp[10] = 10 sgp[11] = 11 ... sgp[96] = 96 sgp[97] = 97 sgp[98] = 98 sgp[99] = 99 $
Local fix
N/A
Problem summary
PROBLEM DESCRIPTION: Incorrect output or segmentation fault occurs as a result of an incorrect internal compiler optimization. USERS AFFECTED: Any user on any platform is platform is affected, however the pervasiveness of this problem is very low.
Problem conclusion
Modified the optimization to be more conservative when attempting to eliminate redundant computation.
Temporary fix
Comments
APAR Information
APAR number
IV01094
Reported component name
XL C AIX
Reported component ID
5724S7000
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-05-27
Closed date
2011-06-20
Last modified date
2011-06-20
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
Fix information
Fixed component name
XL C AIX
Fixed component ID
5724S7000
Applicable component levels
[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0"}]
Document Information
Modified date:
28 September 2021