public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "skylanderr at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/45209] New: coredump in exception handling (gcc44, FreeBSD 7.2) Date: Fri, 06 Aug 2010 13:13:00 -0000 [thread overview] Message-ID: <bug-45209-19529@http.gcc.gnu.org/bugzilla/> (raw) Hello, I have coredump for exception handling in a c++ program using dynamic library. I wrote the minimal application using dlopen to load a libtest_so.so and execute functions in so with dlsym. In the libtest_so.so I throw an exception and try to catch it. Source code: 1) main application test_exception (test.cpp) #include <cstdio> #include <dlfcn.h> typedef void (*TFuncVoid)(); int main() { void* testlib = dlopen("./libtest_so.so", RTLD_NOW | RTLD_GLOBAL); TFuncVoid FFunc = 0; FFunc = TFuncVoid(dlsym(testlib, "ThrowCatchException")); if (FFunc) { try { FFunc(); } catch (...) { printf("Catched in test.cpp. \n"); } } return 0; } 2) library libtest_so.so (test_so.cpp) #include <cstdio> extern "C" void ThrowCatchException() { try { throw 5; } catch (int) { printf("catch (int): la-la-la \n"); } catch (...) { printf("catch (...): la-la-la \n"); } } 3) Commands for compiling the application: g++44 -g -Wall -fPIC -fexceptions -DNATIVE_INCLUDE_PATH="/usr/local/lib/gcc44/include/c++/" -I<include_path_1> -I<include_path_2> -o CMakeFiles/test_exception.dir/test.cpp.o -c <path_to_src>/test/test.cpp g++44 -nostdlib /usr/lib/crt1.o /usr/lib/crti.o /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd7.2/4.4.1/crtbegin.o -g -Wall -fPIC -fexceptions -DNATIVE_INCLUDE_PATH="/usr/local/lib/gcc44/include/c++/" -Wl,-E CMakeFiles/test_exception.dir/test.cpp.o -o test_exception /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd7.2/4.4.1/../../../libsupc++.a /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd7.2/4.4.1/libgcc.a /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd7.2/4.4.1/libgcc_eh.a -lc -lm /usr/local/lib/gcc44/gcc/x86_64-portbld-freebsd7.2/4.4.1/crtend.o /usr/lib/crtn.o 4) Commands for compiling the library: g++44 -g -Wall -fPIC -fexceptions -DNATIVE_INCLUDE_PATH="/usr/local/lib/gcc44/include/c++/" -I<include_path_1> -I<include_path_2> -o CMakeFiles/test_so.dir/test_so.cpp.o -c <path_to_src>/test_so.cpp g++44 -fPIC -g -Wall -fexceptions -DNATIVE_INCLUDE_PATH="/usr/local/lib/gcc44/include/c++/" -shared -Wl,-soname,libtest_so.so -o libtest_so.so CMakeFiles/test_so.dir/test_so.cpp.o 4) correct output (command ./test_exception): "catch (int): la-la-la" 5) wrong result (command ./test_exception): terminate called after throwing an instance of 'int' Abort trap (core dumped) 6) my gcc configuration info (g++44 -v) Using built-in specs. Target: x86_64-portbld-freebsd7.2 Configured with: ./../gcc-4.4-20090616/configure --disable-nls --with-system-zlib --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --program-suffix=44 --libdir=/usr/local/lib/gcc44 --libexecdir=/usr/local/libexec/gcc44 --with-gxx-include-dir=/usr/local/lib/gcc44/include/c++/ --disable-libgcj --prefix=/usr/local --mandir=/usr/local/man --infodir=/usr/local/info/gcc44 --build=x86_64-portbld-freebsd7.2 Thread model: posix gcc version 4.4.1 20090616 (prerelease) (GCC) -- Summary: coredump in exception handling (gcc44, FreeBSD 7.2) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: skylanderr at gmail dot com GCC host triplet: x86_64-unknown-freebsd7.2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45209
next reply other threads:[~2010-08-06 13:13 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2010-08-06 13:13 skylanderr at gmail dot com [this message] 2010-08-06 13:14 ` [Bug c++/45209] " skylanderr at gmail dot com 2010-08-06 13:15 ` skylanderr at gmail dot com 2010-08-06 14:08 ` [Bug target/45209] " rguenth at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-45209-19529@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).