From owner-freebsd-hackers@FreeBSD.ORG Thu Apr 10 14:57:45 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 336BF10656E4 for ; Thu, 10 Apr 2008 14:57:45 +0000 (UTC) (envelope-from babkin@verizon.net) Received: from vms046pub.verizon.net (vms046pub.verizon.net [206.46.252.46]) by mx1.freebsd.org (Postfix) with ESMTP id CCA8B8FC19 for ; Thu, 10 Apr 2008 14:57:44 +0000 (UTC) (envelope-from babkin@verizon.net) Received: from vms244.mailsrvcs.net ([172.18.12.134]) by vms046.mailsrvcs.net (Sun Java System Messaging Server 6.2-6.01 (built Apr 3 2006)) with ESMTPA id <0JZ400IYK6VHXJC1@vms046.mailsrvcs.net> for freebsd-hackers@freebsd.org; Thu, 10 Apr 2008 09:57:18 -0500 (CDT) Received: from 65.242.108.162 ([65.242.108.162]) by vms244.mailsrvcs.net (Verizon Webmail) with HTTP; Thu, 10 Apr 2008 09:57:16 -0500 (CDT) Date: Thu, 10 Apr 2008 09:57:16 -0500 (CDT) From: Sergey Babkin X-Originating-IP: [65.242.108.162] To: Dirk GOUDERS , yuri@rawbw.com Message-id: <31423336.5418911207839437687.JavaMail.root@vms244.mailsrvcs.net> MIME-version: 1.0 Content-type: text/plain; charset=UTF-8 Content-transfer-encoding: 7bit X-Mailman-Approved-At: Thu, 10 Apr 2008 15:44:37 +0000 Cc: freebsd-hackers@freebsd.org, Ted Faber Subject: Re: Re: C++ exceptions are broken in FreeBSD with gcc-compiled code? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Apr 2008 14:57:45 -0000 Oh, this reminded me of something I've seen before. In some version of GCC (3.96? 4.something?) if you declare a function with an explicit throw() declaration and then throw from it an exception that is not in the declaration, the exception never gets caught. It just goes all the way out. Any chance that this is one of these cases? I don't remember the exact details but it looked somewhat like this: void f() throw exception; voif f() { throw(string("zzz")); } main() { try { f(); } catch(exception e) { ... } catch (string s) { ... } } -SB > >> > It works fine for me too, using FreeBSD 6-stable and the built-in gcc >> > 3.4.6 >> > as well as with gcc 4.2.4 20080305 installed from ports. >> > No need to use -pthreads in either case >> >> This means that this issue is STABLE-7.0 specific. > >I am not able to reproduce the problem here; I will compile the >updated sources tonight to check if that changes anything: > ># uname -sr >FreeBSD 7.0-STABLE > ># g++ --version >g++ (GCC) 4.2.1 20070719 [FreeBSD] >Copyright (C) 2007 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. > ># cat exc.C > >#include >#include >using namespace std; > >int main() { > try { > throw string("String"); > } catch (string s) { > cout << "Caught an exception \"" << s << "\"\n"; > } >} > ># g++ -o exc exc.C ># ./exc >Caught an exception "String" >_______________________________________________ >freebsd-hackers@freebsd.org mailing list >http://lists.freebsd.org/mailman/listinfo/freebsd-hackers >To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"