IBM Support

IV46715: INCORRECT OUTPUT WITH DYNAMIC_CAST

Fixes are available

XL C/C++ for AIX Fix Pack 5 (September 2013 PTF) for 12.1
XL C++ Runtime for AIX Fix Pack 3 (September 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 19 (October 2013 PTF) for 10.1
XL C/C++ for AIX Fix Pack 16 (November 2013 PTF) for 11.1
XL C/C++ for AIX Fix Pack 7 (January 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 17 (February 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 8 (March 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 18 (May 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 19 (August 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 20 (November 2014 PTF) for 11.1
XL C/C++ for AIX Fix Pack 11 (February 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 21 (April 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 12 (May 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 13 (August 2015 Update) for 12.1
XL C++ Runtime for AIX Fix Pack 4 (August 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 22 (September 2015 PTF) for 11.1
XL C/C++ for AIX Fix Pack 21 (October 2015 PTF) for 10.1
XL C++ Runtime for AIX Fix Pack 5 (October 2015 PTF) for 12.1
XL C/C++ for AIX Fix Pack 14 (December 2015 Update) for 12.1
XL C/C++ for AIX Fix Pack 23 (March 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 15 (April 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 16 (July 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 24 (September 2016 PTF) for 11.1
XL C/C++ for AIX Fix Pack 17 (November 2016 Update) for 12.1
XL C/C++ for AIX Fix Pack 18 (February 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 19 (August 2017 Update) for 12.1
XL C/C++ for AIX Fix Pack 20 (March 2018 Update) for 12.1
XL C/C++ for AIX Fix Pack 6 (December 2013 PTF) for 12.1
XL C/C++ for AIX Fix Pack 9 (July 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 20 (October 2014 PTF) for 10.1
XL C/C++ for AIX Fix Pack 10 (October 2014 PTF) for 12.1
XL C/C++ for AIX Fix Pack 21 (January 2019 Update) for 12.1

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • When compiling the following test case that makes use of
    dynamic_cast, the compiler does not generate correct code
    leading to incorrect output at runtime.
    
    ====Compile Command:
    $ xlC -qrtti=all test.cpp
    
    
    ====Testcase:
    $ cat test.cpp
    #include <demangle.h>
    #include <stdio.h>
    int main(int argc, char *argv[])
    {
        char* rest = 0;
        char *text_mangled =
            (argc > 1) ? argv[1] : ".funcGlobalOne__Fi";
        printf("text_mangled=\"%s\"\n", text_mangled);
        Name *name = Demangle(text_mangled, rest);
        printf("name=%x\n", name);
        printf("name->Kind()=%d\n", name->Kind());
        char *text_demangled=name->Text();
        printf("text_demangled=\"%s\"\n", text_demangled);
        void *dc = dynamic_cast<void *>(name);
        printf("dynamic_cast<void *>(name)=%x\n", dc); // This
    should not be 0
        return 0;
    }
    $
    
    
    =====Actual Output:
    $ ./a.out
    text_mangled=".funcGlobalOne__Fi"
    name=201be8f8
    name->Kind()=2
    text_demangled=".funcGlobalOne(int)"
    dynamic_cast<void *>(name)=0
    $
    
    
    =====Expected Output:
    $ ./a.out
    text_mangled=".funcGlobalOne__Fi"
    name=20002a30
    name->Kind()=2
    text_demangled=".funcGlobalOne(int)"
    dynamic_cast<void *>(name)=20002a30
    $
    

Local fix

  • N/A
    

Problem summary

  • USERS AFFECTED:
    Users of the demangler library who wish to use dynamic_cast or
    typeid on polymorphic class objects produced by the demangler
    library are affected by this issue.
    
    PROBLEM DESCRIPTION:
    RTTI information is not present for class objects produced by
    demangler library.
    

Problem conclusion

  • The version of the demangler library which is integrated with
    the C++ shared library runtime is now built with support for
    dynamic_cast and typeid.
    The stand-alone version is not updated and should not be used
    with C++ applications without careful isolation measures.
    

Temporary fix

Comments

APAR Information

  • APAR number

    IV46715

  • Reported component name

    XL C++ AIX

  • Reported component ID

    5724U8100

  • Reported release

    C10

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2013-08-07

  • Closed date

    2013-09-18

  • Last modified date

    2013-09-20

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

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

    LI77639

Fix information

  • Fixed component name

    XL C/C++ RUNTIM

  • Fixed component ID

    5725C7201

Applicable component levels

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

Document Information

Modified date:
20 September 2013