delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/28/16:03:47

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <25651906.post@talk.nabble.com>
Date: Mon, 28 Sep 2009 13:03:26 -0700 (PDT)
From: zevel12 <zg DOT nab AT zevelx DOT net>
To: cygwin AT cygwin DOT com
Subject: Re: gcc 4.3.2 rethrow exception
In-Reply-To: <4AC0F662.8090503@gmail.com>
MIME-Version: 1.0
References: <25645396 DOT post AT talk DOT nabble DOT com> <4AC0F662 DOT 8090503 AT gmail DOT com>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com



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 AT 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 AT 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 AT ubik /tmp/cxa/eh
>> $ g++ t.cpp -o t.exe
>> 
>> admin AT ubik /tmp/cxa/eh
>> $ ./t.exe
>> rethrow_ok exception=2
>> rethrow_fail exception=2
>> 
>> admin AT ubik /tmp/cxa/eh
>> $ echo $?
>> 0
>> 
>> admin AT 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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019