IBM Support

IV39827: STD::PAIR OBJECT GIVING BAD OUTPUT WITH OPT

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • After enabling optimization on code that creates std::pair<>
    objects created using NULL pointers, object initialization code
    is optimized away and incorrect output is seen.
    
    
        ==== TEST CASE ====
    
    #include <utility>
    #include <iostream>
    
    class Test;
    
    void g()
    {
        std::pair<int, Test*> tab[3] = {
            std::make_pair(1, (Test*)NULL),
            std::make_pair(1, (Test*)NULL),
            std::make_pair(1, (Test*)NULL)
        };
    
         std::cout   << tab[0].first << '\n';
         std::cout   << tab[0].second << '\n';
         std::cout   << tab[1].first << '\n';
         std::cout   << tab[1].second << '\n';
         std::cout   << tab[2].first << '\n';
         std::cout   << tab[2].second << '\n';
    }
    
    int main()
    {
        g();
    }
    
    
    $ xlC -q64 -O2 test.cpp
    $ ./a.out
    1
    0
    1157627904
    800200140000400
    150994943
    0
    $
    

Local fix

  • Do no use optimization.
    

Problem summary

  • PROBLEM DESCRIPTION:
    Brace list array initialization is giving insufficient aliasing
    information to ensure program correctness.
    
    USERS AFFECTED:
    Runtime brace lists initializing an array of an aggregate type,
    compiled with optimization.
    

Problem conclusion

  • The aliasing issue was resolved, and correct behaviour is now
    given.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV39827

  • Reported component name

    XL C/C++ AIX

  • Reported component ID

    5724X1300

  • Reported release

    B10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-04-16

  • Closed date

    2013-08-13

  • Last modified date

    2013-08-13

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

  • Fixed component ID

    5724X1300

Applicable component levels

  • RB10 PSY U860996

       UP C

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGH3R","label":"XL C\/C++ for AIX"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"11.1","Edition":"","Line of Business":{"code":"LOB57","label":"Power"}}]

Document Information

Modified date:
13 August 2013