Fixes are available
November 2011 PTF for XL C/C++ for AIX, V11.1
January 2012 PTF for XL C for AIX, V11.1
January 2012 PTF for XL C/C++ for AIX, V11.1
April 2012 PTF for XL C for AIX, V11.1
April 2012 PTF for XL C/C++ for AIX, V11.1
July 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C/C++ for AIX, V11.1
October 2012 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C for AIX, V11.1
February 2013 PTF for XL C/C++ for AIX, V11.1
XL C/C++ for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C for AIX Fix Pack 14 (May 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 17 (February 2014 PTF) for 11.1
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
November 2011 PTF for XL C for AIX, V11.1
July 2012 PTF for XL C for AIX, V11.1
XL C for AIX Fix Pack 16 (November 2013 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, the test case below leads to an incorrect if-else being evaluated leading to an incorrect print statement being printed. ===== COMPILE COMMAND: xlC_r test.cpp -q64 -O0 -qipa ===== TESTCASE: $ cat test.cpp #include <stdio.h> #include "test.hpp" void check() { { printf(" contains (range) "); struct { bool stop; uint64_t from1; uint64_t to1; uint64_t from2; uint64_t to2; bool contains12; bool contains21; } data [] = { { false, 0, 0, 0, 0, true, true }, { false, 0x1000, 0x2000, 0x1500, 0x1600, true, false }, { false, 0x1000, 0x2000, 0x1000, 0x2000, true, true }, #ifdef _LP64 { false, 0, 0xFFFFFFFFFFFFFFFFULL, 0xFFFFFFFFFFFFFFF0ULL, 0xFFFFFFFFFFFFFFF1ULL, true, false }, #endif { true, 0, 0, 0, 0, false, false} }; for (int i = 0; !data[i].stop; i ++) { printf("."); AddrRange r1((char*)data[i].from1, (char*)data[i].to1 - (char*)data[i].from1); AddrRange r2((char*)data[i].from2, (char*)data[i].to2 - (char*)data[i].from2); if(r1.contains(r2) == data[i].contains12) printf("+"); else printf("fail\n"); if(r2.contains(r1) == data[i].contains21) printf("+"); else printf("fail\n"); } printf("\n"); } } int main( int argc, char** argv ) { printf("Starting test...\n"); check(); return 0; } $ $cat test.hpp $ cat test.hpp // SAPJVM stuefe 2010-11-22: helper class, describes an address range // class is immutable and should stay that way. class AddrRange { char* const _start; const size_t _size; public: AddrRange(char* start, size_t size) : _start(start), _size(size) {} AddrRange(const AddrRange& r) : _start(r.start()), _size(r.size()) {} char* start() const { return _start; } size_t size() const { return _size; } char* end() const { return _start + _size; } bool is_empty() const { return _size == 0 ? true : false; } static AddrRange empty_range() { return AddrRange(NULL, 0); } bool contains(const char* p) const { return start() <= p && end() > p; } bool contains(const AddrRange& range) const { return start() <= range.start() && end() >= range.end(); } bool intersects(const AddrRange& range) const { return (range.start() <= start() && range.end() > start()) || (range.start() < end() && range.end() >= end()) || contains(range); } bool is_same_range(const AddrRange& range) const { return start() == range.start() && size() == range.size(); } // return the closest inside range consisting of whole pages AddrRange find_closest_aligned_range(size_t pagesize) const; }; $ ===== ACTUAL OUTPUT: $ xlC_r test.cpp -q64 -O0 -qipa $ ./a.out Starting test... contains (range) .++.++.++.fail + $ ===== EXPECTED OUTPUT: $ xlC_r test.cpp -q64 -O0 -qipa $ ./a.out Starting test... contains (range) .++.++.++.++ $
Local fix
N/A
Problem summary
USERS AFFECTED: Users of IPA with -O3 and above may be affected by this issue. PROBLEM DESCRIPTION: In certain cases, the compiler generates incorrect code for comparison with -qipa. In IPA there are various simplifications of expressions. For a specific expression, the compiler was already checking for cases where operands were integers, but did not have a check for the case where the operands where char* or DT_ADDRESS and they eventually get converted to integer.
Problem conclusion
The fix is to check for the char* or DT_ADDRESS possibility.
Temporary fix
Comments
APAR Information
APAR number
IV10097
Reported component name
XL C FOR AIX
Reported component ID
5724X1200
Reported release
B10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt
Submitted date
2011-11-02
Closed date
2011-11-02
Last modified date
2014-05-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
5724X1200
Applicable component levels
Document Information
Modified date:
28 May 2014