Fixes are available
XL C for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 4 (July 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C for AIX Fix Pack 5 (November 2015 Update) for 13.1
XL C/C++ for AIX Fix Pack 5 (November 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 6 (February 2016 PTF) for 13.1
XL C for AIX Fix Pack 6 (February 2016 Update) for 13.1
XL C for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C for AIX Fix Pack 7 (May 2016 Update) for 13.1
XL C/C++ for AIX Fix Pack 7 (May 2016 PTF) for 13.1
XL C for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C for AIX Fix Pack 8 (August 2016 Update) for 13.1
XL C/C++ for AIX Fix Pack 8 (August 2016 PTF) for 13.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C for AIX Fix Pack 9 (June 2017 Update) for 13.1
XL C/C++ for AIX Fix Pack 9 (June 2017 PTF) for 13.1
XL C for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C for AIX Fix Pack 10 (February 2018 Update) for 13.1
XL C/C++ for AIX Fix Pack 10 (February 2018 PTF) for 13.1
XL C for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C for AIX Fix Pack 4 (July 2015 PTF) for 13.1
XL C for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 11 (November 2018 PTF) for 13.1
XL C for AIX Fix Pack 11 (November 2018) for 13.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1
XL C for AIX Fix Pack 21 (January 2019 Update) for 12.1
APAR status
Closed as program error.
Error description
The offset value of a struct member calculated using the offsetof() function is incorrect when referencing designated initializer array elements using an enum. The issue is very sensitive to code changes. Reordering the initializer list, or adding/removing struct members hides the issue. Manually calculating the offset, or using the offsetof() function in a context outside the initializer list works. === EXAMPLE === Note: code is not compilable typedef struct { char type1[32]; unsigned int type2; int type3; } base_struct; enum { T_TYPE1, T_TYPE2, T_TYPE3 }; static const struct { int offset; int num; char name[12]; } my_struct_with_init_list[T_TYPE3 + 1] = { [T_TYPE1] = {offsetof(base_struct, type1) , 0, "type1"}, [T_TYPE2] = {offsetof(base_struct, type2) , 0, "type2"}, [T_TYPE3] = {offsetof(base_struct, type3) , 0, "type3"} };
Local fix
Do not calculate offsetof() in initializer list.
Problem summary
PROBLEM DESCRIPTION: The compiler is having problems calculating the offset value of a struct member via the offsetof() function inside a designated initializer list when string members exist. USERS AFFECTED: Users of the offsetof() function in designated initializers having string members.
Problem conclusion
A fix has been implemented.
Temporary fix
Comments
APAR Information
APAR number
IV70769
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2015-03-10
Closed date
2015-05-25
Last modified date
2015-05-25
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 FOR AIX
Fixed component ID
5725C7100
Applicable component levels
RC10 PSY
UP
Document Information
Modified date:
03 October 2021