delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/09/28/13:32:00

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4AC0F662.8090503@gmail.com>
Date: Mon, 28 Sep 2009 18:46:10 +0100
From: Dave Korn <dave DOT korn DOT cygwin AT googlemail DOT com>
User-Agent: Thunderbird 2.0.0.17 (Windows/20080914)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: gcc 4.3.2 rethrow exception
References: <25645396 DOT post AT talk DOT nabble DOT com>
In-Reply-To: <25645396.post@talk.nabble.com>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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

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

- Raw text -


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