Fixes are available
January 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
April 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
July 2009 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
November 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
March 2011 PTF for XL C/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/C++ Enterprise Edition for AIX, V9.0
January 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
May 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
August 2010 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
September 2008 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
APAR status
Closed as program error.
Error description
Structures have been initialized differently in C and C++ and this is causing a problem to user's application. ==== TESTCASE: #include <stdio.h> #include <string.h> #include <stdlib.h> struct mystruct { char c1; int i; }; static void copy_struct(struct mystruct* pMystruct_temp1) { struct mystruct mystruct_stack = {0}; *pMystruct_temp1 = mystruct_stack; memset(&mystruct_stack,255,sizeof(struct mystruct)); } int main(int argc, char** argv) { struct mystruct struct1; struct mystruct struct2; memset(&struct1,0,sizeof(struct mystruct)); memset(&struct2,0,sizeof(struct mystruct)); copy_struct(&struct1); copy_struct(&struct2); if(memcmp(&struct1,&struct2,sizeof(struct mystruct))) /* where the dbx display is one*/ printf("these structs are different\n"); else printf("these structs are equal\n"); return 0; } ===== ACTUAL OUTPUT: C: these structures are equal C++: thes structures are not equal ===== EXPECTED OUTPUT: REQUIRED, FREEFORM C++: Struct should be initialized to null and the output should be: these structues are equal.
Local fix
Use -qinitauto
Problem summary
The C++ compiler does not zero fill pad bytes between struct members when initialized using braced list initializers. This means that two different structs that are initialized using the same braced list initializer may not be byte wise identical. Although not required in the C++ standard, the xlc compiler as well as several other C++ vendors already do this. Users who initialize structures with braced list initializers are affected.
Problem conclusion
Implemented -qxflag=zerofillpadbytes, which will zero fill pad bytes for auto variables that are POD structs.
Temporary fix
Comments
APAR Information
APAR number
IZ32374
Reported component name
XLC C++ AIX
Reported component ID
5724S7100
Reported release
900
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2008-09-15
Closed date
2008-09-15
Last modified date
2008-09-17
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
5724S7100
Applicable component levels
Document Information
Modified date:
03 October 2021