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

Reply via email to