Fixes are available
November 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
November 2010 PTF for XL C Enterprise Edition for AIX, V9.0
March 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2011 PTF for XL C Enterprise Edition for AIX, V9.0
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
When an unused function is removed from the test case, the test case does not encounter a runtime logic error when compiled with -O2 and -qstaticinline. ===== Test case // Compile with: // xlC -O2 -qstaticinline xlcbug.C -o xlcbug #include <iostream> using namespace std; // This function is not used, but if I remove this, the bug goes away. static inline void foo(void) { cout << endl; } typedef unsigned long ulong; static inline ulong permute_inv(ulong inv, ulong perm) { if (perm >= 6) { ulong i = perm >= 18 ? 2 : (perm+4)/16; perm -= 6*(i+1); i = 3-i; ulong x = ((inv<<i) ^ inv) & 8; inv ^= x ^ (x>>i); } if (perm >= 2) { ulong i = 3 - perm/2; ulong x = ((inv<<i) ^ inv) & 4; inv ^= x ^ (x>>i); } if (perm & (inv ^ (inv>>1)) & 1) inv ^= 3; return inv; } struct FnPermT { unsigned inv : 5; }; int bugfn = 16; static FnPermT minfn[1<<16]; static void init_minfn(void) { ulong inv = permute_inv(1,2); minfn[bugfn].inv = permute_inv(1,2); if (minfn[16].inv != inv) printf("BUG: %u != %lu\n", minfn[bugfn].inv, inv); } int main(void) { init_minfn(); return 0; } ==== Output #xlC -O2 -qstaticinline xlcbug.C -o a.opt # ./a.opt BUG: 0 != 4
Local fix
Remove the 'static inline void foo()' from the test case. When the 'foo()' function is removed, the test case executes successfully. ==== Output # xlC -O2 -qstaticinline xlcbug.C -o b.opt # ./b.opt #
Problem summary
Incorrect displacement calculation results in bad code generation, leading to incorrect output.
Problem conclusion
Fix displacement calculation.
Temporary fix
Comments
APAR Information
APAR number
IZ83423
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
2010-08-23
Closed date
2010-11-09
Last modified date
2010-11-09
APAR is sysrouted FROM one or more of the following:
APAR is sysrouted TO one or more of the following:
IZ88723 LI75809 IZ91492 IZ92730 LI75873 LI75902 LI75991 LI76012
Fix information
Fixed component name
XL C AIX
Fixed component ID
5724S7000
Applicable component levels
Document Information
Modified date:
06 October 2021