public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/44438]  New: ISO C99 6.7.4p3 not obeyed in C99 mode
@ 2010-06-07  7:27 nickc at redhat dot com
  2010-06-07  9:55 ` [Bug c/44438] " jsm28 at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: nickc at redhat dot com @ 2010-06-07  7:27 UTC (permalink / raw)
  To: gcc-bugs

Section 6.7.4 paragraph 3 of the ISO C99 standard states that:

    An inline definition of a function with external
    linkage ... shall not contain a reference to an identifier with
    internal linkage.

GCC has code to check for this condition, but it does not work in C99 mode.

Reproduce by:

  % cat iso-c99-test.c
  static int a = 7;
  extern inline int foo (void) { return a; }
  int main (void) { return foo (); }

  % gcc -c iso-c99-test.c
  iso-c99-test.c:2:39: warning: 'a' is static but used in inline function 'foo'
which is not static [enabled by default]

  % gcc -c -std=c99 iso-c99-test.c
  %


-- 
           Summary: ISO C99 6.7.4p3 not obeyed in C99 mode
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nickc at redhat dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44438


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c/44438] ISO C99 6.7.4p3 not obeyed in C99 mode
  2010-06-07  7:27 [Bug c/44438] New: ISO C99 6.7.4p3 not obeyed in C99 mode nickc at redhat dot com
@ 2010-06-07  9:55 ` jsm28 at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2010-06-07  9:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jsm28 at gcc dot gnu dot org  2010-06-07 09:54 -------
That's not an "inline definition", so that constraint does not apply.

    If all of the file scope declarations for a function in a translation
    unit include the inline function specifier without extern, then the
    definition in that translation unit is an inline definition.

(6.7.4#6)


-- 

jsm28 at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44438


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-07  9:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-07  7:27 [Bug c/44438] New: ISO C99 6.7.4p3 not obeyed in C99 mode nickc at redhat dot com
2010-06-07  9:55 ` [Bug c/44438] " jsm28 at gcc dot gnu dot org

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).