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
When compiling the following test case with -O2, the resulting binary leads to an incorrect output: ===== COMPILE COMMAND: xlC_r -qmakedep=gcc -D_AIX51 -D_LARGE_FILES -D__NO_XLC_BUILTIN_VA -DOS_LEVEL=710 -D_Packed= -qnotempinc -U__unix -q64 -qtbtable=full -qhalt=e -qalias=noansi -qutf -+ -O -qfdpr -qstrict -qlibansi -qinlglue -qmaxmem=-1 -DNDEBUG -qarch=pwr4 -qtune=balanced -qspill=2560 -qlonglong -qalign=natural -qldbl128 -qdebug=RNSSMALL -c -o test.o test.c xlC_r -o a.out -bcdtors:mbr::s -bweaklocal -q64 -brtl -bbigtoc -lc -lc128 test.o -lperfstat -lrt -lwlm -lpthread -lm ===== TESTCASE: $ cat test.c #include <stdio.h> #include <stdlib.h> #include <unistd.h> typedef unsigned short P_CHAR; static bool isStandardChar(P_CHAR &c) { printf ("-->isStandardChar (%d: %c) a: %d z: %d \n",(P_CHAR) c, (P_CHAR) c, (P_CHAR)u'a', (P_CHAR)u'z'); if ( (c >= (P_CHAR) u'a') && (c <= (P_CHAR) u'z') ) { return true; } else if ( (c >= (P_CHAR) u'A') && (c <= (P_CHAR) u'Z') ) { return true; } else if ( (c >= (P_CHAR) u'0') && (c <= (P_CHAR) u'9') ) { return true; } else if ( ( c == u'_') || ( c == u':') || ( c == u'/') || ( c == u'-') || ( c == u';') ) { return true; } return false; } int main(int argc, char** argv) { P_CHAR c = 117; if ( isStandardChar(c) ) printf ("%c is a StandardChar\n", (P_CHAR) c); else printf ("%c is NOT a StandardChar\n", (P_CHAR) c); return 0; } $ ===== ACTUAL OUTPUT: $ ./restKrn -->isStandardChar (117: u) a: 97 z: 122 u is NOT a StandardChar $ ===== EXPECTED OUTPUT: $ ./restKm -->isStandardChar (117: u) a: 97 z: 122 u is a StandardChar
Local fix
Change typedef unsigned short P_CHAR; to typedef unsigned int P_CHAR; as a workaround.
Problem summary
USERS AFFECTED: Users who perform a range check of alphabetical ASCII characters (a-z,A-Z) in their code may be affected by this issue. PROBLEM DESCRIPTION: The compiler optimizes out an IF clause under specific circumstances whenever a char is checked for the range of alphabetical ASCII characters (a-z,A-Z). This occured because a parameter passed was mangled without restoring to next parameter.
Problem conclusion
The compiler has been fixed to properly check the range of alphabetical ASCII characters (a-z,A-Z).
Temporary fix
Comments
APAR Information
APAR number
IV62591
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
C10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2014-07-17
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
RC10 PSY UP
C
Document Information
Modified date:
21 August 2024