This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gcc 4.3.2 rethrow exception




Dave Korn-6 wrote:
> 
> zevel12 wrote:
>> Rethrowing an exception in Cygwin's gcc 4.3.2 causes an abort. This works
>> with gcc 3.4.4 and in Linux with gcc 4. Below is an example that is
>> compiled
>> as: gcc rethrow.cpp -lstdc++.
> 
>   This could be a "Well, don't do that then" situation.  I tried your
> testcase, but I compiled it using "g++ t.cpp" and got a working executable
> with no sign of an abort:
> 
>> admin@ubik /tmp/cxa/eh
>> $ cat t.cpp
>> #include <stdio.h>
>> #include <stdlib.h>
>> 
>> void test2() throw(int)
>> {
>>         throw 2;
>> }
> 
>   [ snip - same as in OP ]
> 
>> 
>> admin@ubik /tmp/cxa/eh
>> $ g++ --version
>> g++ (GCC) 4.3.2 20080827 (beta) 2
>> Copyright (C) 2008 Free Software Foundation, Inc.
>> This is free software; see the source for copying conditions.  There is
>> NO
>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>> PURPOSE.
>> 
>> 
>> admin@ubik /tmp/cxa/eh
>> $ g++ t.cpp -o t.exe
>> 
>> admin@ubik /tmp/cxa/eh
>> $ ./t.exe
>> rethrow_ok exception=2
>> rethrow_fail exception=2
>> 
>> admin@ubik /tmp/cxa/eh
>> $ echo $?
>> 0
>> 
>> admin@ubik /tmp/cxa/eh
>> $
> 
>   It's always best to use the proper language driver for compiling C++
> instead
> of adding -lstdc++ to the C compiler command-line, in fact it's not a
> supported mode of operation and in upcoming versions of the compiler will
> be
> non-conformant because it'll break the libstdc++ malloc wrappers.  Please
> let
> us know if using the g++ driver fixes the problem for you.
> 
>     cheers,
>       DaveK
> 
> 
> --
> Problem reports:       http://cygwin.com/problems.html
> FAQ:                   http://cygwin.com/faq/
> Documentation:         http://cygwin.com/docs.html
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> 
> 
> 
It did indeed fix the problem. As an added note, I also had to use g++ as
the linker instead of gcc in my makefiles.

Thanks,
-z
-- 
View this message in context: http://www.nabble.com/gcc-4.3.2-rethrow-exception-tp25645396p25651906.html
Sent from the Cygwin list mailing list archive at Nabble.com.


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]