IBM Support

LI75770: TEMPLATE ASSIGNMENT OPERATOR CALLS ITSELF

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • template assignment operator calls itself recursively in the
    example below leading to segfault at runtime.
    
    
    ///////////////////// test.cpp //////////////////////
    
    template<typename First> struct Base
    {
      template<typename OtherFirst>
      First& operator=(const Base<OtherFirst>& other) { }
    
    inline First& operator=(const Base& other) {
       return operator=<First>(other); }
    };
    
    int main()
    {
     Base<int> a;
     a = Base<int>();
     return 0;
    }
    
    ////////////////// end of test.cpp //////////////////////
    
    $xlC test.cpp
    $./a.out
    Segmentation fault (core dumped)
    

Local fix

  • N/A
    

Problem summary

  • Assignment operator call with explicit template args may invoke
    incorrect function
    

Problem conclusion

  • The problem is isolated to the FE and a fix has been dropped.
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI75770

  • Reported component name

    XL C/C++ AE BG/

  • Reported component ID

    5799HJE00

  • Reported release

    900

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt

  • Submitted date

    2010-11-18

  • Closed date

    2011-04-25

  • Last modified date

    2011-04-25

Fix information

  • Fixed component name

    XL C/C++ AE BG/

  • Fixed component ID

    5799HJE00

Applicable component levels

  • R900 PSY

       UP

[{"Business Unit":{"code":"BU054","label":"Systems w\/TPS"},"Product":{"code":"SSJT9L","label":"XL C\/C++"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"9.0","Line of Business":{"code":"LOB08","label":"Cognitive Systems"}}]

Document Information

Modified date:
15 October 2021