Fixes are available
November 2011 PTF for XL C/C++ for AIX, V11.1
November 2011 IBM XL C++ Runtime for AIX, V11.1
December 2011 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
January 2012 PTF for XL C/C++ for AIX, V11.1
February 2012 PTF for XL C/C++ for AIX, V10.1
March 2012 PTF for XL C/C++ Enterprise Edition for AIX, V9.0
April 2012 PTF for XL C/C++ for AIX, V11.1
May 2012 PTF for XL C/C++ for AIX, V10.1
July 2012 PTF for XL C/C++ for AIX, V11.1
September 2012 PTF for XL C/C++ for AIX, V10.1
October 2012 PTF for XL C/C++ for AIX, V11.1
January 2013 PTF for XL C/C++ for AIX, V10.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/C++ for AIX Fix Pack 18 (July 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 15 (August 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (October 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 16 (November 2013 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 (October 2014 PTF) for 10.1
XL C/C++ for AIX Fix Pack 20 (November 2014 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/C++ for AIX Fix Pack 21 (October 2015 PTF) for 10.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
APAR status
Closed as program error.
Error description
For the following test case, the default constructor gets called when it should have called the correct constructor that took in two params. The test case has this allocator class that requires a constructor with one parameter. It declares the default constructor as private to ensure it is never called. Then, the test case creates an unordered_map using that allocator. So they instantiate the unordered map using that allocator class, but when it constructs the unordered_map object, the test case passes an explicitly constructed allocator object to the unordered_map constructor. ===== COMPILE COMMAND: xlC vector.C -D__IBMCPP_TR1__=1 ===== TESTCASE: $ cat vector.C #include <stdlib.h> #include <stdio.h> #include <vector> #ifdef __GNUC__ #include <tr1/unordered_map> #else #include <unordered_map> #endif template <class U> class alloc { private: alloc() { printf("private cons %x\n", (long) this);} public: alloc(int x) { printf("public cons %x: %d\n", (long) this, x);} template <class UU> alloc(const alloc<UU> &A) { } template <class UU> struct rebind { typedef alloc<UU> other; }; typedef size_t size_type; typedef ptrdiff_t difference_type; typedef U *pointer; typedef const U *const_pointer; typedef U &reference; typedef const U &const_reference; typedef U value_type; pointer address(reference x) const; const_pointer address(const_reference x) const; template <class UU> pointer allocate( size_type elements, const UU* base) { return (pointer)malloc(elements); } pointer allocate( size_type elements) { return (pointer)malloc(elements); } void deallocate( pointer addr, size_type n) { free(addr); } void construct(pointer p, const U& val) { new ((void *)p) U(val); } void destroy( pointer addr) { } size_type max_size() const { return 1000000000;} private: }; int main() { std::tr1::hash<unsigned> h; std::equal_to<unsigned> e; alloc<std::pair<const unsigned, unsigned> >a(1); std::tr1::unordered_map<unsigned, unsigned, std::tr1::hash<unsigned>, std::equal_to<unsigned>, alloc<std::pair<const unsigned, unsigned> > > m(3,h,e,a); } $ ===== ACTUAL OUTPUT: $ ./a.out public cons 2ff227f0: 1 private cons 2ff226b0 private cons 2ff226c0 $ ===== EXPECTED OUTPUT: $ ./a.out public cons ffbde0fa: 1 $
Local fix
n/a
Problem summary
USERS AFFECTED: Users using TR1 unordered_map with allocators expecting that allocator arguments are honoured are affected by this issue. PROBLEM DESCRIPTION: unordered_map may cause default construction of allocators despite provided allocator argument.
Problem conclusion
The allocator argument is now passed to constructors for subobjects of unordered_map.
Temporary fix
Comments
APAR Information
APAR number
IV02851
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-07-05
Closed date
2011-10-26
Last modified date
2011-10-26
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++ RUNTIME
Fixed component ID
5724X1301
Applicable component levels
RB10 PSY U848515
UP C
Document Information
Modified date:
26 October 2011