From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17894 invoked by alias); 25 Apr 2003 00:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 17787 invoked by uid 71); 25 Apr 2003 00:36:01 -0000 Resent-Date: 25 Apr 2003 00:36:01 -0000 Resent-Message-ID: <20030425003601.17784.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, David.Moore@intel.com Received: (qmail 15219 invoked by uid 48); 25 Apr 2003 00:30:46 -0000 Message-Id: <20030425003046.15218.qmail@sources.redhat.com> Date: Fri, 25 Apr 2003 00:36:00 -0000 From: David.Moore@intel.com Reply-To: David.Moore@intel.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/10489: Implementation of extern inline is exactly backwards X-SW-Source: 2003-04/txt/msg01063.txt.bz2 List-Id: >Number: 10489 >Category: c >Synopsis: Implementation of extern inline is exactly backwards >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Apr 25 00:36:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: David Moore >Release: gcc 3.2 20020903 >Organization: >Environment: Red Hat Linux 8.0 3.2.7 >Description: When extern inline is used on a function definition, a body for that function must be layed down in the current compilation unit binary. When just inline is given, no body should be layed down. See the C99 standard ISO/EEC 9899:1999. 6.7.4 says that if all the declarations of a function are "inline" (not "extern inline") the compilation unit does not provide an external definition for the function. That is, the body is not layed down. Otherwise, if the extern storage class specifier is used, a body must be layed down as per section 6.9. However, gcc 3.2 lays down a body when extern is not given and fails to do so when extern is used - exactly the opposite of what is required. Example code: =========================== #include EXTERNAL inline lay_me_down_maybe(int i) {return i*i+2;} int main () {return lay_me_down_maybe(42);} gcc -c -O2 -DEXTERNAL=extern example.c nm example.o 00000000 T main gcc -c -O2 -DEXTERNAL= example.c nm example.o 00000010 T lay_me_down_maybe 00000000 T main >How-To-Repeat: >Fix: Fix is probably simply a matter of flipping a condition but beware that there are uses of this in the gnu C header files where the usage is believed to also be backwards. >Release-Note: >Audit-Trail: >Unformatted: