Fixes are available
APAR status
Closed as program error.
Error description
The test case below results in a core dump with the following sequence: 1: A destructor is called twice for the same object. Note the sequence of events in the attachment 2: The second time the destructor is called, the object is corrupted ================== Test Case: # cat x.cpp #include <iostream> template< typename T > static const char *hexdump( T* p ) { static char buf[1024]; char *pbuf = buf; pbuf += sprintf( buf, "%p ", p ); unsigned char *pc = (unsigned char*)p; for ( size_t i = 0; i < sizeof(*p); i ++ ) { *pbuf++ = "0123456789abcdef"[ pc[i]>>4 ]; *pbuf++ = "0123456789abcdef"[ (pc[i]& 0xf) ]; } *pbuf++ = '\0'; return buf; } class I { public: I() :x_(0x1234567890abcdef) { std::cout << "I() " << hexdump(this) << "\n"; } ~I() { std::cout << "~I() " << hexdump(this) << ( x_ == 0x1234567890abcdef ? "" : " !!! <--- CORRUPTED " ) << "\n"; } private: long int x_; }; class E : public std::exception { public: E() noexcept { std::cout << "E() " << hexdump(this) << "\n"; } E(const E&) noexcept { std::cout << "E() " << hexdump(this) << "\n"; } E& operator=( const E& e ) = delete; virtual ~E() noexcept { std::cout << "~E() " << hexdump(this) << "\n"; } private: I guard_[2]; }; static void f() { try { std::cout << "* throw E\n"; throw E(); } catch ( const E& ) { try { throw E(); } catch ( const E& ) { } } std::cout << "handled\n"; } int main() { f(); f(); } ================== Results: # make x xlclang++ -g -std=c++11 -q64 x.cpp # ./a.out * throw E I() 110012fd8 1234567890abcdef I() 110012fe0 1234567890abcdef E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef I() 1100130f8 1234567890abcdef I() 110013100 1234567890abcdef E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~I() 110013100 1234567890abcdef ~I() 1100130f8 1234567890abcdef ~E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef ~I() 110012fe0 1234567890abcdef ~I() 110012fd8 1234567890abcdef handled * throw E I() 110012fd8 1234567890abcdef I() 110012fe0 1234567890abcdef E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef ~E() 1100130f0 000000011000086800000000000000001234567890abcdef ~I() 110013100 1234567890abcdef ~I() 1100130f8 0000000000000000 !!! <--- CORRUPTED I() 1100130f8 1234567890abcdef I() 110013100 1234567890abcdef E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~I() 110013100 1234567890abcdef ~I() 1100130f8 1234567890abcdef ~E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef ~I() 110012fe0 1234567890abcdef ~I() 110012fd8 1234567890abcdef Handled copy above to file named x.cpp ==========Compile Command: xlclang++ -g -std=c++11 -q64 x.cpp: Result from the second throw E: * throw E I() 110012fd8 1234567890abcdef I() 110012fe0 1234567890abcdef E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef ~E() 1100130f0 000000011000086800000000000000001234567890abcdef ~I() 110013100 1234567890abcdef ~I() 1100130f8 0000000000000000 !!! <--- CORRUPTED I() 1100130f8 1234567890abcdef I() 110013100 1234567890abcdef E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~E() 1100130f0 00000001100008681234567890abcdef1234567890abcdef ~I() 110013100 1234567890abcdef ~I() 1100130f8 1234567890abcdef ~E() 110012fd0 00000001100008681234567890abcdef1234567890abcdef ~I() 110012fe0 1234567890abcdef ~I() 110012fd8 1234567890abcdef Handled In the above results, the destructor in the second throw E has a different results than the first throw.
Local fix
N/A
Problem summary
USERS AFFECTED: User who have nested try catch blocks are prone to encounter this issue. PROBLEM DESCRIPTION: A runtime core dump in exception handling path may occur with this issue.
Problem conclusion
The compiler runtime was handling nested try catch blocks incorrectly, and has now been fixed.
Temporary fix
Comments
APAR Information
APAR number
IJ13421
Reported component name
XL C/C++ FOR AI
Reported component ID
5725C7200
Reported release
G10
Status
CLOSED PER
PE
NoPE
HIPER
NoHIPER
Special Attention
NoSpecatt / Xsystem
Submitted date
2019-02-11
Closed date
2019-03-28
Last modified date
2019-03-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/C++ RUNTIM
Fixed component ID
5725C7201
Applicable component levels
RG10 PSY
UP
[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G10"}]
Document Information
Modified date:
23 September 2021