IBM Support

PI86240: ISSUES WITH XLC COPY ON WRITE

A fix is available

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.                                  *
    ****************************************************************
    * 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

  • Apply service provided.
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI86240

  • Reported component name

    ANSI C++ CLASS

  • Reported component ID

    568819807

  • Reported release

    7B0

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2017-08-23

  • Closed date

    2018-04-23

  • Last modified date

    2019-07-01

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

    IV96373

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

Fix information

  • Fixed component name

    ANSI C++ CLASS

  • Fixed component ID

    568819807

Applicable component levels

  • R7B0 PSY UI63379

       UP19/06/28 P F906

Fix is available

  • Select the PTF appropriate for your component level. You will be required to sign in. Distribution on physical media is not available in all countries.

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SG19M","label":"APARs - z\/OS environment"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7B0","Edition":"","Line of Business":{"code":"","label":""}},{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSTLTF","label":"z\/OS XL C\/C++"},"Component":"","ARM Category":[],"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"7B0","Edition":"","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
01 July 2019