From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 128763 invoked by alias); 26 Jun 2018 11:39:24 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 128716 invoked by uid 89); 26 Jun 2018 11:39:23 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=H*i:sk:f0e5d83, H*f:sk:f0e5d83, marks X-HELO: mx1.redhat.com Subject: Re: Invalid program counters and unwinding To: Nathan Sidwell , GCC , GNU C Library , Binutils , gnu-gabi@sourceware.org References: <7ada5491-f3f4-e048-dfec-6e51cd937163@acm.org> <0c58f1bb-220c-d03d-7375-6066fb7d53e6@redhat.com> <0b0e49f0-7ed0-aa4e-a4df-d4286206dab5@acm.org> <8a147f05-509f-16a0-f108-9e76bcae4ea9@redhat.com> From: Florian Weimer Message-ID: Date: Tue, 26 Jun 2018 11:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-SW-Source: 2018-06/txt/msg00790.txt.bz2 On 06/26/2018 01:35 PM, Nathan Sidwell wrote: > On 06/26/2018 07:21 AM, Florian Weimer wrote: > >> GCC doesn't do this AFAIK, but it's theoretically possible not to >> preserve the return address for a noreturn function.  But that would >> be very bad for exception handling, so let's hope compilers don't do >> this. > > I'd forgotten about noreturn.  Such functions may terminate by throwing > an exception (and for our purposes I think pthread_cancel implementatio > is sufficiently exception-like): > > from C++ std:  [dcl.attr.noreturn]/2 [ Note: The function may terminate > by throwing an exception. — end note ] > > and from doc/extend.texi: > > The @code{noreturn} keyword does not affect the exceptional path > when that applies: a @code{noreturn}-marked function may still > return to the caller by throwing an exception or calling > @code{longjmp}. > > IIRC, in gcc-land you have to give both noreturn and nothrow attributes > to make it non-unwindable. Are you sure? I was under the impression that GCC did not do this because it interferes too much with debugging. Furthermore, glibc marks abort as nothrow and noreturn, which is a bit dubious, considering that it is perfectly fine to throw exception from synchronously delivered signals. Thanks, Florian