The following cut-down code gets core-dump with g++ on SLES11, the problem does
not exist on CELL and AIX g++.

#include <stdio.h>
#include <stdlib.h>
#include <exception>

int f(int);
int g(int i);
void my_terminate();
typedef void(*Function_Pointer) ();

int xx_exceptions = 0;
class xx {
public:
    xx(int i) { v = i;}
    int v;
};

class aa {
public:
    aa() {}
    ~aa() { throw xx(1); } 
};

int main()
{
    Function_Pointer set_terminate(Function_Pointer);
    std::set_terminate(&my_terminate); 
    f(1);
    return 55;
}

void my_terminate()
{
    fflush(0);
    exit(55);
}

int f(int i)
{
    aa x;

    try {
        return g(0);
    }
    catch ( xx xobj) {
        xx_exceptions ++ ;      
    }
}

int g(int i)
{
    if (i == 0) throw xx(1);
}


====================================
Part of core-dump details:

the coredump is from libgcc_s.so.1
warning: Can't read pathname for load map: Input/output error.
Reading symbols from
/nfs/adam/.../torolab.ibm.com/fs/proj/p0/vabld/run/vacpp/dev/sles10_ppc/daily/081216/opt.ibmcmp.lib64/libibmc++.so.1...done.
Loaded symbols for
/.../torolab.ibm.com/fs/projects/vabld/run/vacpp/dev/sles10_ppc/daily/081216//opt/ibmcmp/lib64/libibmc++.so.1
Reading symbols from /usr/lib64/libstdc++.so.6...done.
Loaded symbols for /usr/lib64/libstdc++.so.6
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libgcc_s.so.1...done.
Loaded symbols for /lib64/libgcc_s.so.1
Reading symbols from /lib64/libc.so.6...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/ld64.so.1...done.
Loaded symbols for /lib64/ld64.so.1
Core was generated by `./abc '.
Program terminated with signal 11, Segmentation fault.
#0  0x00000400002fd1ec in ?? () from /lib64/libgcc_s.so.1


-- 
           Summary: SLES11: SEGV with try/throw/catch/terminate() at -q64
           Product: gcc
           Version: 4.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: aixing at ca dot ibm dot com


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

Reply via email to