This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
segmentation in unexpected_handler
- To: egcs-bugs at cygnus dot com
- Subject: segmentation in unexpected_handler
- From: Nick Godbey <nick at sidi dot com>
- Date: Tue, 30 Jun 1998 19:16:44 +0000
- Organization: SID
I get a segmentation when overriding the unexpected_handler with
myh own. I wish to throw a known error object from my
unexpected_handler.
System RedHat Linux 5.0
egcs 1.0.2
binutils 2.8.1
glibc 2.0.6
gdb output
Program received signal SIGSEGV, Segmentation fault.
0x4006ad43 in memcpy (dstpp=0xbfffb2b0, srcpp=0xbfffb2c8, len=4)
at ../sysdeps/generic/memcpy.c:57
../sysdeps/generic/memcpy.c:57: No such file or directory.
Current language: auto; currently c
Program:
#include <iostream.h>
class TestErr
{
public:
TestErr()
: i(1)
{}
~TestErr() {}
int i;
};
class TestWarning
{
public:
TestWarning()
: i(2)
{}
~TestWarning() {}
int i;
};
void throw_func();
void test_func() throw ( TestErr );
// replace unexpected handler with our own.
typedef void(*PFV)();
PFV set_unexpected(PFV);
void our_unexpected_handler();
void our_unexpected_handler ()
{
throw TestErr();
}
void throw_func()
{
throw TestWarning();
}
void test_func() throw ( TestErr )
{
throw_func();
}
int main(int argc, char* agrv[])
{
set_unexpected( our_unexpected_handler );
try
{
test_func();
}
catch( TestErr err)
{
cout << "caught TestErr\n";
}
return 0;
}