Fixes are available
XL C/C++ for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 22 (September 2015 PTF) for 11.1
XL C for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C for AIX Fix Pack 22 (September 2015 PTF) for 11.1
APAR status
Closed as program error.
Error description
When compiling with -qipa=level=0, certain pointer arithmetic is done incorrectly. The result could be incorrect output or incorrect memory access. === EXAMPLE === int func(mystruct *obj, char *bp, int copy) { char *pstart = bp; if (copy) { obj->val1 = (*(unsigned int *)bp); bp += 4; obj->val2 = (*(unsigned int *)bp); bp += 4; } else { bp += 8; } return (bp - pstart); } The bp pointer is only incremented by (4+4)=8, leaving (bp - pstart)=8, but for the code generated, the value of pstart used in the subtraction (in gr0) has been incremented by 4**, which ends up giving (bp+8)-(pstart+4)=4, when the return result should be 8: | 000000 PDEF func 0| PROC obj,bp,copy,gr3-gr5 6| 000080 cmpwi 2C050000 1 C4 cr0=gr5,0 ** 8| 000084 addi 38040004 1 AI gr0=gr4,4 6| 000088 bc 41820020 1 BT CL.2,cr0,0x4/eq 8| 00008C lwz 80A40000 1 L4A gr5=(*)uint.rns0.(gr4,0) 9| 000090 lwz 80C40004 1 L4A gr6=(*)uint.rns0.(gr4,4) 9| 000094 addi 38840008 1 AI gr4=gr4,8 8| 000098 stw 90A30000 1 ST4A (*)mystruct.mystruct.val1.rns1.(gr3,0)=gr5 9| 00009C stw 90C30004 1 ST4A (*)mystruct.mystruct.val2.rns2.(gr3,4)=gr6 15| 0000A0 subf 7C602050 1 S gr3=gr4,gr0 0| 0000A4 bclr 4E800020 1 BA lr 9| CL.2: 13| 0000A8 addi 38040008 1 AI gr0=gr4,8 15| 0000AC subf 7C640050 1 S gr3=gr0,gr4 16| 0000B0 bclr 4E800020 1 BA lr
Local fix
Do not use -qipa
Problem summary
PROBLEM DESCRIPTION: An incorrect runtime value is calculated by an internal code optimization. USERS AFFECTED: Any users of -qipa, or any options that imply -qipa (for example, -qpdf1).
Problem conclusion
The optimization was corrected, and IPA now generates correct code giving correct runtime values.
Temporary fix
Comments
APAR Information
APAR number
IV58760
Reported component name
XL C/C++ AIX
Reported component ID
5724X1300
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2014-04-04
Closed date
2014-04-25
Last modified date
2014-04-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
5724X1200
Applicable component levels
Document Information
Modified date:
25 April 2014