[Bug c/68272] Unwanted out-of-line instances for C inline functions that are also GCC builtins.
sorganov at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 11 11:32:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68272
Sergey Organov <sorganov at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|FIXED |---
--- Comment #3 from Sergey Organov <sorganov at gmail dot com> ---
Sorry again, but digging into the problem further, it still seems like a bug in
GCC (both 4.x and 5.x).
First, for gcc 4.x, using neither -std=gnu99 nor -std=gnu11 (nor c11, nor c99)
makes the problem go away.
Second, declaring the inline function "extern inline" allows the example to
compile/link correctly with -std=gnu89 (but not in recent x99 or x11 modes)
that is expected and sane behavior.
Now, from the GCC manual, it follows that to port "inlines" from 89 to 99 and
above, one needs to (mostly) turn "extern inline" to "inline", that does work
in all other cases but GCC builtin functions.
I realize all this is on the raw edge with standard C functions, but current
GCC behavior with builtins in x99 and x11 modes seems to be just a left-over
from x89 days. Even from pure consistency POV it looks like a good idea to fix
it, provided there is no good reason to violate standard C "inline" semantics
for GCC builtin functions.
More information about the Gcc-bugs
mailing list