IBM Support

LI81525: INVALID DESTRUCTOR CALL INSERTED AFTER __BUILTIN_CONSTANT_P() BUILTIN

Subscribe to this APAR

By subscribing, you receive periodic emails alerting you to the status of the APAR, along with a link to the fix after it becomes available. You can track this item individually or track all items by product.

Notify me when this APAR changes.

Notify me when an APAR for this component changes.

 

APAR status

  • Closed as program error.

Error description

  • Usage of the __builtin_constant_p() builtin with a class
    constructor is leading to the generation of a paired destructor
    for the object.  After the builtin is evaluated, the destructor
    is still present in the code, even though no object is created,
    leading to an invalid delete/free() memory call for objects
    never initialized.
    
    
       === TEST CASE ===
    
    #include <cstdio>
    
    int main(int argc, char *argv[]) {
        class Test {
        public:
            Test() {
                std::printf("Test::Test\n");
            }
    
            ~Test() {
                std::printf("Test::~Test\n");
            }
        };
        __builtin_constant_p(Test());
    }
    
    
    $ xlc++ test.cpp
    $ ./a.out
    Test::~Test
    $
    

Local fix

Problem summary

  • PROBLEM DESCRIPTION:
    Implicit destructor calls will remain while the initialization
    inside a __builtin_constant_p call will be discarded.
    
    USERS AFFECTED:
    __builtin_constant_p calls, which contain implicit destructor
    calls.
    

Problem conclusion

  • The compiler will now evaluate the __builtin_constant_p builtin
    before the generation of the implicit destructor call.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI81525

  • Reported component name

    XL C/C++ LINUX

  • Reported component ID

    5725C7310

  • Reported release

    G11

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2020-06-29

  • Closed date

    2020-11-03

  • Last modified date

    2020-11-03

  • 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++ LINUX

  • Fixed component ID

    5725C7310

Applicable component levels

[{"Line of Business":{"code":"LOB57","label":"Power"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSXVZZ","label":"XL C\/C++ for Linux"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"G11"}]

Document Information

Modified date:
04 November 2020