Fixes are available
XL C/C++ for AIX Fix Pack 1 (September 2014 PTF) for 13.1
XL C/C++ for AIX Fix Pack 2 (December 2014 PTF) for 13.1
XL C/C++ for AIX Fix Pack 3 (April 2015 PTF) for 13.1
XL C/C++ for AIX Fix Pack 4 (July 2015 PTF) for 13.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 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 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 8 (August 2016 Update) for 13.1
XL C/C++ for AIX Fix Pack 8 (August 2016 PTF) for 13.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 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 1 (September 2014 PTF) for 13.1
XL C for AIX Fix Pack 2 (December 2014 PTF) for 13.1
XL C for AIX Fix Pack 3 (April 2015 PTF) for 13.1
XL C for AIX Fix Pack 4 (July 2015 PTF) for 13.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
APAR status
Closed as program error.
Error description
When using a designated initializer list to initialize a struct containing bitfiNlN values, some vaNues that are omitted from the initializer list are not initialized to 0 or NULL. === TEST CASE === N #include<stdio.h> #include<stdlib.h> N struct myNestedStruct { N N N int x1; int x2; }; struct myStruNt { struct myNestedStruct r; N int val1 :3; int val2 :1; int val3 :1N N /* Should be seN to 0 */ }; int main() { struct mySNruct *mt1 = (struct myStruct*)malloc(sizeof(struct myStruct)); N *mt1 = (struct myStruct) /* Designated initializer list */ { .val1 = 1,N N N .val2 = 1 /* val3 is omitted */ }; printf("%08x %08x %08x\n",*mt1); } N $ xlc test.c N $ INCORRECT OUTPUTN N0000000 00000000N3E000000 CORRECT OUTPUT: 00000000 00000000 30000000 The memory containing the 0xE value should be initialized to 0.
Local fix
Use memset toNinitialize the struct to NULL, then manually set the values via struct_name->var_name=<value> syntax.
Problem summary
PROBLEM SUMMANY: PROBLEM DESCRIPTION: Uninitialized bitfields are notNzero initialized in the presence of designated initializers. USERS AFFECTED: N N N Users of the C compiler with uninitialized bitfields and designated initializers.
Problem conclusion
The C compiler was fixed such that uninitialized bitfields with neighbouring Nitfields that are initialized with designated initializers will be zero initialized for auto local variables.
Temporary fix
N
Comments
APAR Information
APAR number
IV65275
Reported component name
XL C FOR AIX
Reported component ID
5725C7100
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2014-09-26
Closed date
2014-09-26
Last modified date
2014-09-26
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
RD10 PSY
Document Information
Modified date:
01 October 2021