From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22110 invoked by alias); 17 Mar 2003 00:32:45 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 22071 invoked from network); 17 Mar 2003 00:32:44 -0000 Received: from unknown (HELO smtp1.euronet.nl) (194.134.35.133) by sources.redhat.com with SMTP; 17 Mar 2003 00:32:44 -0000 Received: from koffie.nl (unknown [62.234.210.143]) by smtp1.euronet.nl (Postfix) with ESMTP id 6B61D67124; Mon, 17 Mar 2003 01:32:39 +0100 (MET) Message-ID: <3E72CA19.1000101@koffie.nl> Date: Mon, 17 Mar 2003 04:38:00 -0000 From: Segher Boessenkool User-Agent: Mozilla/5.0 (Macintosh; U; PPC; en-US; rv:1.2.1) Gecko/20021130 X-Accept-Language: en MIME-Version: 1.0 To: Dale Johannesen Cc: Robert Dewar , echristo@redhat.com, Richard.Earnshaw@arm.com, aph@redhat.com, gcc@gcc.gnu.org Subject: Re: -fobey-inline (was Re: gcc and inlining) References: <9BA5B65A-55C8-11D7-B9FE-000393D76DAA@apple.com> In-Reply-To: <9BA5B65A-55C8-11D7-B9FE-000393D76DAA@apple.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2003-03/txt/msg01089.txt.bz2 Dale Johannesen wrote: > Those of you who think inlining is guaranteed to be semantically neutral > might consider this.... > > #include > static jmp_buf buf; > inline void x() { setjmp(buf); } > main() { x(); longjmp(buf); } 6.7.4 Function specifiers 3 An inline definition of a function with external linkage shall not contain a definition of a modifiable object with static storage duration, and shall not contain a reference to an identifier with internal linkage. x() has external linkage; buf has internal linkage. This program is non-conforming. Either x() should be declared static, or buf should not. With that fixed, we still have 7.13.2.1 The longjmp function 2 The longjmp function restores the environment saved by the most recent invocation of the setjmp macro in the same invocation of the program with the corresponding jmp_buf argument. If there has been no such invocation, or if the function containing the invocation of the setjmp macro has terminated execution in the interim, [...] the behavior is undefined. x() has terminated execution when longjmp() is called (there is a sequence point inbetween), so this program is non-conforming. Well that's how I read the standard, but IANALL, of course. Does this help? Segher