Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nrbca-0000Rm-Uw for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:36:05 -0400 Received: from [199.232.76.173] (port=39463 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrbca-0000RR-GM for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:36:04 -0400 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NrbcX-0007lD-Tn for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:36:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32076) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NrbcS-0007kU-1R for qemu-devel@nongnu.org; Tue, 16 Mar 2010 14:36:01 -0400 From: Markus Armbruster Subject: Re: [Qemu-devel] Re: [PATCH, RFC] Replace assert(0) with abort() or cpu_abort() References: <20100316175234.GC19160@shareable.org> Date: Tue, 16 Mar 2010 19:35:41 +0100 In-Reply-To: <20100316175234.GC19160@shareable.org> (Jamie Lokier's message of "Tue, 16 Mar 2010 17:52:34 +0000") Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jamie Lokier Cc: Paolo Bonzini , qemu-devel@nongnu.org Jamie Lokier writes: > Paolo Bonzini wrote: >> On 03/15/2010 07:36 PM, Markus Armbruster wrote: >> >Please don't tell me that user emulators make abort() return. abort() >> >is declared __noreturn__, and the optimizer may well rely on that. >>=20 >> If the user programs make a "signal (SIGABRT, SIG_IGN)" call, I suppose= =20 >> abort() will return. > > On Linux, man abort says: > > If the SIGABRT signal is ignored, or caught by a handler that ret= urns, > the abort() function will still terminate the process. It does th= is by > restoring the default disposition for SIGABRT and then raising the= sig=E2=80=90 > nal for a second time. > > However I have a suspicious that I've seen abort() return on some > other OS in the distant past, maybe SunOS 4. Dark age. > I wouldn't rely on abort() always terminating the process on all OSes. Such behavior is not permitted by ISO C: 7.20.4.1 The abort function [...] The abort function causes abnormal program termination to occur, unless the signal SIGABRT is being caught and the signal handler does not return. [...] The abort function does not return to its caller.