Fixes are available
April 2009 XL C/C++ Enterprise Edition V8.0 for AIX PTF
May 2007 XL C/C++ Enterprise Edition V8.0 for AIX PTF
December 2006 XL C/C++ Enterprise Edition V8.0 for AIX PTF
May 2008 XL C/C++ Enterprise Edition V8.0 for AIX PTF
August 2008 XL C/C++ Enterprise Edition V8.0 for AIX PTF
February 2007 XL C/C++ Enterprise Edition V8.0 for AIX PTF
November 2007 XL C/C++ Enterprise Edition V8.0 for AIX PTF
August 2006 XL C/C++ Enterprise Edition V8.0 for AIX PTF
April 2010 XL C/C++ Enterprise Edition V8.0 for AIX PTF
June 2011 XL C/C++ Enterprise Edition V8.0 for AIX PTF
July 2009 XL C/C++ Enterprise Edition V8.0 for AIX PTF
October 2009 XL C/C++ Enterprise Edition V8.0 for AIX PTF
July 2007 XL C/C++ Enterprise Edition V8.0 for AIX PTF
August 2007 XL C/C++ Enterprise Edition V8.0 for AIX PTF
February 2008 XL C/C++ Enterprise Edition V8.0 for AIX PTF
November 2008 XL C/C++ Enterprise Edition V8.0 for AIX PTF
APAR status
Closed as program error.
Error description
Statements need to be declared twice when using the -O option. Otherwise, an incorrect output is obtained. When compiled with xlC -O test.cpp the actual output is obtained only if "buffer[0] = ..." are stated twice. -------------output------------- exp: 0 1 a5 a5 act: be ef a5 a5 -------------end of output---- ========Test Case=========== extern "C" { int printf(const char *,...); } inline void putInt16(char *buffer, int value) { typedef const union { int d_variable; char d_bytes[1]; }& T; buffer[0] = T(value).d_bytes[sizeof value - 2]; buffer[1] = T(value).d_bytes[sizeof value - 1]; buffer[0] = T(value).d_bytes[sizeof value - 2]; buffer[1] = T(value).d_bytes[sizeof value - 1]; } int main() { const unsigned short unsignedNumber = 1; for (int di = 0; di < 1; ++di) { char buffer[4] = {0xa5,0xa5,0xa5,0xa5}; putInt16(buffer , unsignedNumber); printf("act: %01x %01x %01x %01x\n", buffer[0], buffer[1], buffer[2], buffer[3]); } return 0; } =========End of Test case =========
Local fix
Modify the union and variable T such that T.d_variable holds the value of 'value'. for example: union{ int d_variable; char d_bytes[1]; }T; T.d_variable = value; buffer[0] = T.d_bytes[sizeof value - 2]; buffer[1] = T.d_bytes[sizeof value - 1];
Problem summary
Anyone optimizing and using inlining. A function that is being inlined is taking the address of a parameter. At the call site the parameter is a literal. The generated code is trying to take the address of a constant.
Problem conclusion
We changed the compiler to store the literal into a temporary since the parameter is address taken.
Temporary fix
Comments
APAR Information
APAR number
IY87090
Reported component name
XLC C++ AIX
Reported component ID
5724M1200
Reported release
800
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2006-07-19
Closed date
2006-08-30
Last modified date
2007-09-13
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
XLC C++ AIX
Fixed component ID
5724M1200
Applicable component levels
R800 PSY U813114
UP07/09/13 I 1000
Document Information
Modified date:
03 October 2021