Fixes are available
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 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 compiling with -O2, the resulting binary produces incorrect results at runtime: ===== COMPILE COMMAND: xlc -q64 -qarch=pwr7 -O2 f.c main.c ===== TESTCASE: $ cat f.c double f(long *l, double *d) { l[0] = (int)*d; return *d - (int)*d; } $ cat main.c #include <stdio.h> int main() { long l; double d = 42.42; extern double f(long *l, double *d); f(&l, &d); printf("%lx\n", l); return 0; } $ ===== ACTUAL OUTPUT: $ ./a.out 2a0000002a $ ===== EXPECTED OUTPUT: $ ./a.out 2a $
Local fix
N/A
Problem summary
USERS AFFECTED: Users who have code that casts from double to int may see this problem. Optimization level must be at least O2 for this problem to appear. PROBLEM DESCRIPTION: Cast form double to int will sometimes produce incorrect results.
Problem conclusion
The problem was caused by an optimization that went too far and sometimes folded instructions when it was not correct to do so. The fix prevents that folding in those incorrect situations.
Temporary fix
Comments
APAR Information
APAR number
IV70765
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
Submitted date
2015-03-10
Closed date
2015-07-28
Last modified date
2015-07-28
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
Document Information
Modified date:
03 October 2021