IBM Support

IV96373: ISSUES WITH XLC COPY ON WRITE

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • The following test case demonstrates an issue with the
    copy-on-write string implementation that is enabled with
    single-threaded builds:
    
    
    ===== COMPILE COMMAND:
    xlC test.cpp
    
    ===== TESTCASE:
    $ cat test.cpp
    #include <cassert>
    #include <iostream>
    #include <string>
    #include <vector>
    
    int main()
    {
    std::string s("abc");
    
    // this vector should never be modified
    const std::vector<std::string> v(256, s);
    
    // modify the string
    s[0] = 'z';
    
    std::cout << "s = " << s << '\n';
    std::cout << "v[ 0] = " << v[ 0] << '\n';
    std::cout << "v[ 1] = " << v[ 1] << '\n';
    std::cout << "v[253] = " << v[253] << '\n';
    std::cout << "v[254] = " << v[254] << '\n';
    std::cout << "v[255] = " << v[255] << '\n';
    
    assert(0 == s.compare("zbc"));
    assert(0 == v[ 0].compare("abc"));
    assert(0 == v[ 1].compare("abc"));
    assert(0 == v[253].compare("abc"));
    assert(0 == v[254].compare("abc"));
    assert(0 == v[255].compare("abc"));
    }
    $
    
    ===== ACTUAL OUTPUT:
    $ xlC test.cpp
    $ ./a.out
    s = zbc
    v[ 0] = zbc
    v[ 1] = zbc
    v[253] = zbc
    v[254] = abc
    v[255] = abc
    Assertion failed: 0 == v[ 0].compare("abc"), file  test.cpp,
    line 24
    IOT/Abort trap
    $
    
    
    ===== EXPECTED OUTPUT:
    $ xlC test.cpp
    $ ./a.out
    s = zbc
    v[ 0] = abc
    v[ 1] = abc
    v[253] = abc
    v[254] = abc
    v[255] = abc
    $
    

Local fix

  • Use xlC_r instead of xlC invocation as a workaround.
    

Problem summary

  • USERS AFFECTED:
    Users who have a string referenced 254 or more times and modify
    the string afterwards are affected by this issue.
    
    PROBLEM DESCRIPTION:
    The runtime fails to perform copy on write when a string's
    reference count
    is 254 and as a result, the write affects items where the string
    is referenced.
    

Problem conclusion

  • The issue has been fixed.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV96373

  • Reported component name

    XL C/C++ FOR AI

  • Reported component ID

    5725C7200

  • Reported release

    D13

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-05-22

  • Closed date

    2017-06-28

  • Last modified date

    2017-06-28

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

    PI86240

Fix information

  • Fixed component name

    XL C/C++ RUNTIM

  • Fixed component ID

    5725C7201

Applicable component levels

  • RD13 PSY

       UP

[{"Business Unit":{"code":"BU048","label":"IBM Software"},"Product":{"code":"SSC6KWG","label":"C\/C++ Runtime"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"D13","Edition":"","Line of Business":{"code":"","label":""}}]

Document Information

Modified date:
28 June 2017