LTO and C99 inline functions broken (was: Type-generic macros with C)
Jörg Leis
joerg@joergleis.com
Sun Jul 11 18:29:00 GMT 2010
On Sat, 2010-05-01 at 10:01 -0700, Ian Lance Taylor wrote:
> Jörg Leis <joerg@joergleis.com> writes:
>
> > A related question: Is it expected that in C99-mode GCC might not be
> > able to compile a program because of the use of an inline function? I
> > defined an inline function like this:
> >
> > inline int do()
> > {
> > // ...
> > }
>
> C99 mode should support inline functions just fine. If you are having
> trouble, show us the complete test case and tell us what happens.
> Also the version of gcc makes a difference; full support for C99
> inline functions was first in gcc 4.3.
>
> Ian
The problem seemed to have gone for a while, but I have a test case now:
inline int f()
{
return 5;
}
extern inline int f();
With
gcc -std=c99 -c test.c
it compiles just fine and emits the an externally callable definition
of f. However, with LTO,
gcc -std=c99 -flto -c test.c
the function f is not emitted. The GCC version is "gcc (GCC) 4.5.0
20100610 (prerelease)".
Jörg
More information about the Gcc-help
mailing list