Fixes are available
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
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 13 (August 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.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 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.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 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 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 9 (July 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C for AIX Fix Pack 11 (February 2015 PTF) for 12.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 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 xlc compiler incorrectly produces an error message for the provided test case. ===== COMPILE COMMAND: xlc -c xlc-anon-struct.c ===== TESTCASE: $ cat xlc-anon-struct.c struct foo { float *a; char c; }; void bar(int *x) { } void baz(struct foo *x) { } int main(void) { int i = 42; float x = 42.0f; struct foo a = { .a = &x, .c = 'f' }; bar((int []){i}); baz((struct foo[]){a}); } $ ===== ACTUAL OUTPUT: $xlc -c xlc-anon-struct.c "xlc-anon-struct.c", line 17.22: 1506-196 (S) Initialization between types "float*" and "struct foo" is not allowed. $ ===== EXPECTED OUTPUT: Clean compile
Local fix
As a workaround, if the line: baz((struct foo[]){a}); is replaced with: baz((struct foo[]){{.a = &x, .c = 'f'}}); it compiles clean.
Problem summary
USERS AFFECTED: Users who wish to put non literal expressions in a curly braced initialiser list for arrays of structs and unions may be affected by this issue. PROBLEM DESCRIPTION: The compiler is only accepting literal and compound literal expressions in curly braced array initialiser lists for arrays of structs and unions.
Problem conclusion
Changed the compiler to accept expressions other than compound literal expressions, as long as they are of the correct type.
Temporary fix
Comments
APAR Information
APAR number
IV55636
Reported component name
XL C FOR AIX
Reported component ID
5725C7100
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2014-02-19
Closed date
2014-07-18
Last modified date
2014-07-18
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
Document Information
Modified date:
03 October 2021