[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
g++ exception problem with -fno-rtti option
From: |
Kurt Carlson |
Subject: |
g++ exception problem with -fno-rtti option |
Date: |
Tue, 17 Oct 2000 16:37:41 -0500 |
Has anyone seen the following before or better yet know of a patch for
it? I'm using egcs-2.91.66 (egcs-1.1.2) and when I compile and run the
following program I get a seg fault if the -fno-rtti option is enabled.
According to the docs that I found I should be able to use exceptions with
the -fno-rtti option. It is always when the outer most catch block is
exiting that the program crashes. I tried g++ 2.95.1 and it had the same
problem and an extra one (only called the catch all block, not the
catch(char*) before seg faulting). Any ideas would be appreciated.
Thanks,
Kurt
// results
Starting........
in test1, throwing a string
catch char* test1: p = String
Segmentation fault (core dumped)
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/lib/libstdc++-libc6.1-1.so.2...done.
Reading symbols from /lib/libm.so.6...done.
Reading symbols from /lib/libc.so.6...done.
Reading symbols from /lib/ld-linux.so.2...done.
#0 0x4004df5a in __is_pointer (p=0x8048a5f)
from /usr/lib/libstdc++-libc6.1-1.so.2
#1 0x4004be45 in __cp_pop_exception (p=0x8049d90)
from /usr/lib/libstdc++-libc6.1-1.so.2
#2 0x804880e in main ()
#3 0x400939cb in __libc_start_main (main=0x80486e0 <main>, argc=1,
argv=0xbffffb44, init=0x8048530 <_init>, fini=0x8048a0c <_fini>,
rtld_fini=0x4000ae60 <_dl_fini>, stack_end=0xbffffb3c)
at ../sysdeps/generic/libc-start.c:92
compile command line: g++ -o testProg -fno-rtti test.cpp
// Test Program
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char* argv[])
{
printf("Starting........\n");
try {
printf("in test1, throwing a string\n");
throw "String";
}
catch(char* p) {
printf("catch char* test1: p = %s\n",p);
}
catch(...) {
printf("catch all test1\n");
}
printf("after test1 catch\n");
try {
printf("in test2 throwing an int\n");
throw 1;
}
catch(char* p) {
printf("catch char* test2: p = %s\n",p);
}
catch(...) {
printf("catch all test2\n");
}
printf("after test2 catch\n");
printf("Ending........\n");
return 0;
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- g++ exception problem with -fno-rtti option,
Kurt Carlson <=