The program below crashes with illegal instruction when rethrowing the
previously caught exception.

GCC version:

$ powerpc-ibm-aix5.2.0.0-gcc-4.0.2 -v
Using built-in specs.
Target: powerpc-ibm-aix5.2.0.0
Configured with: ../gcc-4.0.2/configure --disable-nls --enable-threads=posix
--enable-languages=c,c++ --disable-shared
--enable-version-specific-runtime-libs 
Thread model: aix
gcc version 4.0.2

$ powerpc-ibm-aix5.2.0.0-gcc-4.0.2 exctest.cpp -lstdc++ -o exctest


#include <string>

struct FzException
{
  const char *what()
  {
    mWhat = std::string("a") + std::string("b");
    return mWhat.c_str();
  }

  std::string mWhat;
};


int main(int, char **argv)
{
  try
  {
    try
    {
      throw FzException();
    }
    catch(FzException & e)
    {
      e.what();
      throw;
    }
  }
  catch(...)
  {
    exit(1);
  }
}


-- 
           Summary: Program crashes when rethrowing exception
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot klein at fazi dot de
 GCC build triplet: powerpc-ibm-aix5.2.0.0
  GCC host triplet: powerpc-ibm-aix5.2.0.0
GCC target triplet: powerpc-ibm-aix5.2.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26397

Reply via email to