gcc 4.3.2 rethrow exception

Dave Korn dave.korn.cygwin@googlemail.com
Mon Sep 28 17:31:00 GMT 2009


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



More information about the Cygwin mailing list