Date: Sun, 18 Jan 2009 01:38:12 -0800 From: Garrett Cooper <yanefbsd@gmail.com> To: xorquewasp@googlemail.com Cc: Nate Eldredge <neldredge@math.ucsd.edu>, freebsd-hackers@freebsd.org Subject: Re: gcc 4.3.2 libgcc_s.so exception handling broken? Message-ID: <7d6fde3d0901180138y61cf4a8bgc01fd5baa684954b@mail.gmail.com> In-Reply-To: <20090118074057.GB43496@logik.internal.network> References: <20090117231404.GB77134@logik.internal.network> <Pine.GSO.4.64.0901172248030.18030@zeno.ucsd.edu> <20090118074057.GB43496@logik.internal.network>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 17, 2009 at 11:40 PM, <xorquewasp@googlemail.com> wrote: > On 2009-01-17 23:07:29, Nate Eldredge wrote: >> I tried a simple example of this in C++ and it works as expected. (I am= on >> 7.0-RELEASE/amd64.) So it isn't completely busted, at least. >> >> Can you post an example that exhibits the problem? Ideally, something >> complete that can be compiled and is as simple as possible. If you can = do >> it with C++ rather than Ada it might be easier, so people don't have to >> install the Ada compiler. Also please mention the commands you use to >> compile, and what they output when you compile using -v, and what >> architecture you are on. > > Hello. > > You're right, the C++ example works here. I'm not sure why it didn't befo= re. > > Here's a C++ version: > > /* main.cpp */ > > #include <stdio.h> > > extern "C" { > extern void > c_function (void (*func)(int x)); > } > > void > ext_function (int x) > { > printf ("-- ext_function %d\n", x); > throw "test_error"; > } > > int > main (void) > { > try { > c_function (&ext_function); > } catch (...) { > printf ("caught test_error\n"); > } > return 0; > } > > /* c_function.c */ > > #include <stdio.h> > > void > c_function (void (*func)(int x)) > { > printf ("-- %s enter\n", __func__); > func (23); > printf ("-- %s exit\n", __func__); > } > > $ uname -smir > FreeBSD 6.4-RELEASE-p1 i386 GENERIC > > $ gcc43 -v > Using built-in specs. > Target: i386-portbld-freebsd6.4 > Configured with: ./..//gcc-4.3.2/configure --enable-languages=3Dc,ada --= disable-nls --with-system-zlib --with-libiconv-prefix=3D/usr/local --progra= m-suffix=3D43 --bindir=3D/usr/local/bin/gcc43 --libdir=3D/usr/local/lib/gcc= -4.3.2 --prefix=3D/usr/local --mandir=3D/usr/local/man --infodir=3D/usr/loc= al/info/gcc43 --build=3Di386-portbld-freebsd6.4 > Thread model: posix > gcc version 4.3.2 (GCC) > > $ c++ -v > Using built-in specs. > Configured with: FreeBSD/i386 system compiler > Thread model: posix > gcc version 3.4.6 [FreeBSD] 20060305 > > $ gcc43 -o c_function.o -c c_function.c -fPIC -fexceptions -g -W -Werror= -Wall -std=3Dc99 -pedantic-errors -Wno-unused-parameter > $ gcc43 -shared -Wl,-soname,c_function.so -o c_function.so c_function.o = -lc > $ c++ -o main.o -c main.cpp -fexceptions -g -W -Werror -Wall -pedantic-e= rrors -Wno-unused-parameter > $ c++ -o main-dynamic main.o c_function.so > $ c++ -o main-static main.o c_function.o > > $ ./main-static > -- c_function enter > -- ext_function 23 > caught test_error > LD_LIBRARY_PATH=3D. ./main-dynamic > -- c_function enter > -- ext_function 23 > caught test_error > > This example is problematic, however - the C++ compiler is 3.4.6 > (I'm not sure how to compile a 4.3.2 gcc with C, Ada and C++ support). I'd check the release notes between 4.2.x and 4.3.x, and see whether or not they invalidated a certain lexigraphical part of C++ that was a gray area, which could be affecting your compilation. Have you possibly discussed this very issue on the gcc lists yet? Also, what CFLAGS / CXXFLAGS / CPUTYPE are you using? Cheers, -Garrett
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7d6fde3d0901180138y61cf4a8bgc01fd5baa684954b>