public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: David.Moore@intel.com
To: gcc-gnats@gcc.gnu.org
Subject: c/10488: Implementation of extern inline is exactly backwards
Date: Fri, 25 Apr 2003 00:36:00 -0000	[thread overview]
Message-ID: <20030425002652.12264.qmail@sources.redhat.com> (raw)


>Number:         10488
>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:00 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 <stdio.h>
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:


             reply	other threads:[~2003-04-25  0:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-25  0:36 David.Moore [this message]
2003-04-25  0:46 Andrew Pinski
2003-04-25  0:57 bangerth
2003-04-25  8:46 Joseph S. Myers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030425002652.12264.qmail@sources.redhat.com \
    --to=david.moore@intel.com \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).