From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 9 18:26:09 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 CB4271065671 for ; Wed, 9 Apr 2008 18:26:09 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from ch-smtp01.sth.basefarm.net (ch-smtp01.sth.basefarm.net [80.76.149.212]) by mx1.freebsd.org (Postfix) with ESMTP id 4F4B08FC1C for ; Wed, 9 Apr 2008 18:26:09 +0000 (UTC) (envelope-from erikt@midgard.homeip.net) Received: from c83-253-25-183.bredband.comhem.se ([83.253.25.183]:51413 helo=falcon.midgard.homeip.net) by ch-smtp01.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1Jjezm-0007HK-3R for freebsd-hackers@freebsd.org; Wed, 09 Apr 2008 20:26:08 +0200 Received: (qmail 55227 invoked from network); 9 Apr 2008 20:26:02 +0200 Received: from owl.midgard.homeip.net (10.1.5.7) by falcon.midgard.homeip.net with ESMTP; 9 Apr 2008 20:26:02 +0200 Received: (qmail 46321 invoked by uid 1001); 9 Apr 2008 20:26:02 +0200 Date: Wed, 9 Apr 2008 20:26:02 +0200 From: Erik Trulsson To: Ted Faber Message-ID: <20080409182602.GA46118@owl.midgard.homeip.net> Mail-Followup-To: Ted Faber , Yuri , freebsd-hackers@freebsd.org References: <47FCF12D.3070902@rawbw.com> <20080409172905.GA33086@zod.isi.edu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20080409172905.GA33086@zod.isi.edu> User-Agent: Mutt/1.5.17 (2007-11-01) X-Originating-IP: 83.253.25.183 X-Scan-Result: No virus found in message 1Jjezm-0007HK-3R. X-Scan-Signature: ch-smtp01.sth.basefarm.net 1Jjezm-0007HK-3R be4f0711d41da79445f59e07eaf6d286 Cc: Yuri , freebsd-hackers@freebsd.org Subject: 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: Wed, 09 Apr 2008 18:26:09 -0000 On Wed, Apr 09, 2008 at 10:29:05AM -0700, Ted Faber wrote: > On Wed, Apr 09, 2008 at 09:39:09AM -0700, Yuri wrote: > > I am unable to make a C++ program to catch an exception using the the > > system g++ compiler. > > > > > cat exc.C > > #include > > #include > > using namespace std; > > > > int main() { > > try { > > throw string("String"); > > } catch (string s) { > > cout << "Caught an exception \"" << s << "\"\n"; > > } > > } > > > > > > * Failed attempts with system compiler (using /lib/libgcc_s.so.1 and > > FYI it works here: > > zod:~$ cat > test.cc > #include > #include > using namespace std; > > int main() { > try { > throw string("String"); > } catch (string s) { > cout << "Caught an exception \"" << s << "\"\n"; > } > } > zod:~$ g++ test.cc > zod:~$ ./a.out > Caught an exception "String" > zod:~$ g++ -v > Using built-in specs. > Target: i386-undermydesk-freebsd > Configured with: FreeBSD/i386 system compiler > Thread model: posix > gcc version 4.2.1 20070719 [FreeBSD] > zod:~$ uname -a > FreeBSD zod.isi.edu 8.0-CURRENT FreeBSD 8.0-CURRENT #5: Tue Apr 1 > 13:00:38 PDT 2008 root@zod.isi.edu:/usr/obj/usr/src/sys/ZOD i386 > 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. -- Erik Trulsson ertr1013@student.uu.se