This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37917] New: inline functions are lost when defining c99/gnu99 without inline optimizations
- From: "peroyvind at mandriva dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 26 Oct 2008 02:22:29 -0000
- Subject: [Bug c/37917] New: inline functions are lost when defining c99/gnu99 without inline optimizations
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
gcc will simply remove functions if they're declared inline without
optimizations.
testinline.c:
inline int testinline()
{
return 1;
}
int main(int argc, char *argv[])
{
return testinline();
}
[peroyvind@lappis src]$ gcc -std=gnu99 testinline.c; echo $?
/home/peroyvind/tmp/ccKURkmv.o: In function `main':
testinline.c:(.text+0x15): undefined reference to `testinline'
collect2: ld returned 1 exit status
1
[peroyvind@lappis src]$
Ouchy! test() is simply removed, making main() call a non-existing function..
[peroyvind@lappis src]$ gcc -std=gnu99 -finline testinline.c; echo $?
0
[peroyvind@lappis src]$
Works swell, function gets inlined.
[peroyvind@lappis src]$ gcc -std=gnu99 -fgnu89-inline testinline.c; echo $?
0
[peroyvind@lappis src]$
Same behaviour as when using gnu89, function doesn't get inlined, nor does it
get removed..
With -fgnu89-inline giving the expected behaviour, I feel a bit confused
whether this is actually a bug or intended? I lack insight, but I sure hope
using inline functions without gcc optimizations resulting in breakage isn't
intended.
--
Summary: inline functions are lost when defining c99/gnu99
without inline optimizations
Product: gcc
Version: 4.3.2
Status: UNCONFIRMED
Severity: major
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: peroyvind at mandriva dot org
GCC build triplet: x86_64-manbo-linux-gnu
GCC host triplet: x86_64-manbo-linux-gnu
GCC target triplet: x86_64-manbo-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37917