Fixes are available
APAR status
Closed as program error.
Error description
When using -qpdf2 together with the modified config file that has -qlibansi, the resulting exe gets a stack address instead of a heap address as shown in the "ACTUAL OUTPUT" section. If you remove either -qpdf2 or -qlibansi, you get a heap address. ===Testcase: $ cat t.c #include <stdio.h> typedef struct tc { FILE *fp; int version; } tc; int func1(void **outp) { tc *tc_ptr = (tc *) NULL; tc_ptr = (tc *) malloc(sizeof(tc)); /* allocate 16 bytes */ if (tc_ptr == NULL) /* if NULL, goto cleanup */ goto cleanup; tc_ptr->fp = (FILE *) NULL; /* set members of struct tc */ tc_ptr->version = 0; *outp = (void *) tc_ptr; /* return tc_ptr in *outp */ tc_ptr = NULL; /* set to NULL, so it is not freed */ /* when we fall through label cleanup */ cleanup: if (tc_ptr) free(tc_ptr); return 0; } main() { void *ptr; func1(&ptr); /* allocate memory for ptr pointing to 'struct tc' */ printf("ptr 0x%lx\n", ptr); /* print allocated ptr */ } $ ===== ACTUAL OUTPUT: $ rm t.o t $ xlc t.c -c -o t.o -O3 -qpdf2=pdfname= -qnoipa -q64 -qflag=e:e 1586-003 (W) Required parameters for option "-qpdf1/2=pdfname=" are not specified. 1586-401 (E) File "._pdf" not found. $ xlc -q64 -g -o t t.o $ ./t ptr 0x1100007b0 <-- heap address With a customized xlc.cfg that has libansi.a on the link step: $ rm t.o t $ xlc t.c -F./xlc_mod.cfg -c -o t.o -O3 -qpdf2=pdfname= -qnoipa -q64 -qflag=e:e 1586-003 (W) Required parameters for option "-qpdf1/2=pdfname=" are not specified. 1586-401 (E) File "._pdf" not found. $ xlc -q64 -g -o t t.o ./t ptr 0xfffffffffff7c10 <-- stack address ===== EXPECTED OUTPUT: The expectation is heap address
Local fix
N/A
Problem summary
USERS AFFECTED: Clients who are linking with -qlibansi and -qpdf2 mayby affected by this issue. PROBLEM DESCRIPTION: There was a backend compiler optimization that was not doing a heap conversion calcuation correctly; which resulted in this issue.
Problem conclusion
The heap conversion calculation in the optimization is now fixed.
Temporary fix
Comments
APAR Information
APAR number
IJ12232
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
D10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2018-12-21
Closed date
2018-12-21
Last modified date
2018-12-21
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
UP
[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH2K","label":"XL C for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"13.1"}]
Document Information
Modified date:
22 September 2021