The sample program fails to run on Linux x86_64.  
I'm using ...
  gcc (GCC) 3.4.6 20060404 (Red Hat 3.4.6-8)
... and compiling with command line ...
  g++ -Os catch.cpp -o catch.exe

=== Program Output ===
./catch.exe 
file = catch.cpp
Segmentation fault

=== SAMPLE Program ===
#include <stdexcept>
#include <exception>
#include <iostream>

void MyExceptionHandler(const char* p_file)
{
    try 
    {
        throw;
    }
    catch (std::exception& stdexc) 
    {
        std::cerr << "file = " << p_file << std::endl;
    }
}

int main(int argc, char** argv)
{
    try 
    {
        throw std::runtime_error("Throw some error, this should get caught.");
    }
    catch(...)
    {
        MyExceptionHandler(__FILE__);
    }

    printf("RETURNED SAFELY\n");
    return 0;
}


-- 
           Summary: sigsegv occurs when an exception handler rethrows an
                    excpetion and tries to return from the catch
           Product: gcc
           Version: 3.4.6
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: phamorsky at yahoo dot com


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

Reply via email to