IBM Support

LI76731: INLINE ASM MAY CAUSE SEGMENTATION FAULT

Subscribe

You can track all active APARs for this component.

APAR status

  • Closed as program error.

Error description

  • When inline assembly (asm("")) is used in a compilation unit,
    the C++ compiler does not handle C++ exceptions correctly.
    
    The symptoms range  from exceptions not being thrown, to not
    being caught correctly, to segmentation faults.
    
    Consider the following testcase test.cc:
    
    ///////////// test.cc //////////////////
    
    #include <cstdio>
    #include <exception>
    using namespace std;
    
    void junk() {
      asm("nop");
    }
    
    int main(int argc, char** argv) try {
      throw std::exception();
    } catch (...) {
      puts("Caught Exception");
    }
    ///////////////////////////////////////
    
    Compile testcase:
    
    $xlC test.cc
    
    Execute the binary:
    
    $./a.out
    Segmentation fault
    

Local fix

  • N/A
    

Problem summary

  • parts of ehframe descriptor are missing or wrong in inline asm
    

Problem conclusion

  • recommended for C++ users who also use inline asm
    

Temporary fix

Comments

APAR Information

  • APAR number

    LI76731

  • 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

    2012-04-25

  • Closed date

    2012-08-27

  • Last modified date

    2012-08-27

Fix information

  • Fixed component name

    XL C/C++ AE BG/

  • Fixed component ID

    5799HJE00

Applicable component levels

  • R900 PSY

       UP



Document information

More support for: XL C/C++
Compiler

Software version: 9.0

Reference #: LI76731

Modified date: 27 August 2012


Translate this page: