Bug 34697 - gcc -std=gnu99 emits global symbol for extern inline function declarations
Summary: gcc -std=gnu99 emits global symbol for extern inline function declarations
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 4.0.1
: P3 normal
Target Milestone: 4.3.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-06 23:20 UTC by dan
Modified: 2008-01-07 10:04 UTC (History)
2 users (show)

See Also:
Host: i686-apple-darwin9
Target: i686-apple-darwin9
Build: i686-apple-darwin9
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description dan 2008-01-06 23:20:54 UTC
Here's the source code:

   extern inline void f() {}
   int main () {}

Compile with

    gcc -c -std=gnu99 filename.c

Use nm filename.o to see that a global symbol f has been declared, but it shouldn't be.

This prevents libgmp from being usable under Mac OS 10.5.

% uname -a
Darwin indigo.local 9.1.0 Darwin Kernel Version 9.1.0: Wed Oct 31 17:46:22 PDT 2007; root:xnu-1228.0.2~1/RELEASE_I386 i386
Comment 1 Andrew Pinski 2008-01-06 23:25:43 UTC
Well extern inline for 4.3.0 and before in C99 mode was the GNU 89 extern inline and not the C99 extern inline.  This was fixed for 4.3.0.
Comment 2 dan 2008-01-07 00:20:13 UTC
Well, if you were right, then gnu99 and gnu89 would have the same behavior, but they don't:

indigo% gcc -c -std=gnu99 foo.c
indigo% nm foo.o
00000000 T _f
00000008 T _main
indigo% gcc -c -std=gnu89 foo.c
indigo% nm foo.o
00000000 T _main
indigo% gcc -v
Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=i686-apple-darwin9 --with-arch=apple --with-tune=generic --host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)
Comment 3 dan 2008-01-07 00:21:19 UTC
PS: it could be a bug inserted by Apple...
Comment 4 Andrew Pinski 2008-01-07 00:28:10 UTC
> Use nm filename.o to see that a global symbol f has been declared, but it
>shouldn't be.

Yes it should, that is what it should do for C99/GNU99. 

>PS: it could be a bug inserted by Apple...

Well no, Apple just fixed extern inline for C99 mode for their 4.0.x compiler.

So GMP has issues with its source not being C99 compatible even though it uses -std=gnu99 .
Comment 5 dan 2008-01-07 01:43:41 UTC
Thank you!
Comment 6 Richard Biener 2008-01-07 10:04:57 UTC
Update your gmp, this was fixed in 4.2.2.

> Well, if you were right, then gnu99 and gnu89 would have the same behavior, but
> they don't:

gnu99 behaves like c99.