From owner-freebsd-hackers@FreeBSD.ORG Wed Apr 9 19:17:08 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 98565106566B for ; Wed, 9 Apr 2008 19:17:08 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from gv-out-0910.google.com (gv-out-0910.google.com [216.239.58.191]) by mx1.freebsd.org (Postfix) with ESMTP id 1C2B78FC1B for ; Wed, 9 Apr 2008 19:17:07 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: by gv-out-0910.google.com with SMTP id n40so578652gve.39 for ; Wed, 09 Apr 2008 12:17:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; bh=ZPXfF2w9V6xzVNVkYYMju7vfLckW2btsSx+kA//+ymg=; b=Xa7wRTv37LvrObO//IZ8C4NS7Bms27ce/C8tvDcsAwI89cKkYgBcNuXub0MdvUbbxdm/luFcE7K6OusRHbhL4Mmme9jf4OvRD+HjTD0juYNdRjtRKn8HlnOYeJzY4n7WpX/vxltFxeHOJxDq1mQMP//4Ug1ICa/y0nH2hAoPTqk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer:mime-version:content-type; b=qcIxqsGNp7zI5acMEljIlkW0e2EogrNfRzfY7S3EGeMxXrtpNAgoF/j8aPeJEzg+3yu2FGvuyyEJZ9uh8InfNTxBmLChkp4y72mQ9ZmGcJKMk2olst4eZWkATuuCpa/4CvbVGgqDBG/hhMZdDEdl6WhLo+BbKw/kSP54CRM5G4U= Received: by 10.150.92.11 with SMTP id p11mr777133ybb.36.1207766923208; Wed, 09 Apr 2008 11:48:43 -0700 (PDT) Received: from kan.dnsalias.net ( [24.218.183.247]) by mx.google.com with ESMTPS id a45sm1192680rne.1.2008.04.09.11.48.35 (version=SSLv3 cipher=OTHER); Wed, 09 Apr 2008 11:48:39 -0700 (PDT) Date: Wed, 9 Apr 2008 14:48:27 -0400 From: Alexander Kabaev To: yuri@rawbw.com Message-ID: <20080409144827.39bc4f33@kan.dnsalias.net> In-Reply-To: <47FCF12D.3070902@rawbw.com> References: <47FCF12D.3070902@rawbw.com> X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.9; i386-portbld-freebsd8.0) Mime-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/iD9spt9QYGHAIGXlAkRJ/Ob"; protocol="application/pgp-signature"; micalg=PGP-SHA1 Cc: 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 19:17:08 -0000 --Sig_/iD9spt9QYGHAIGXlAkRJ/Ob Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Wed, 09 Apr 2008 09:39:09 -0700 Yuri wrote: > I am unable to make a C++ program to catch an exception using the the=20 > system g++ compiler. % c++ -o exc exc.c=20 % ./exc Caught an exception "String" % c++ -O2 -pthread -o exc exc.c % ./exc =20 Caught an exception "String" % c++42 -O2 -pthread -o exc exc.c % ./exc Caught an exception "String" % c++42 -O2 -o exc exc.c =20 % ./exc =20 Caught an exception "String" % cat exc.c #include #include using namespace std; int main() { try { throw string("String"); } catch (string s) { cout << "Caught an exception \"" << s << "\"\n"; } return 0; } % uname -a FreeBSD kan.dnsalias.net 8.0-CURRENT FreeBSD 8.0-CURRENT #0: Sun Apr 6 14:22:23 EDT 2008 ... Same on RELENG_6 (do not have 7.0 around, but 8.0 and 7.0 are identical compiler-wise. Same on 8.0/amd64. BTW, do you have . in your PATH? > g++ -fexceptions -o exc exc.C > exc <=3D=3D=3D=3D should it be ./exc ?=20 Exception raised: Memory allocation failure! ^^^^^^^^^^^ Not in your sample code. --=20 Alexander Kabaev --Sig_/iD9spt9QYGHAIGXlAkRJ/Ob Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.8 (FreeBSD) iD8DBQFH/Q97Q6z1jMm+XZYRAks+AKCGBgEyL0NRgNt+KmBI8r/c+jpvDQCbBZGJ ZNrRh6FBUbN4Cq+axMW/BqQ= =JKzo -----END PGP SIGNATURE----- --Sig_/iD9spt9QYGHAIGXlAkRJ/Ob--