[Bug c++/16922] New: gcc inlines functions with attribute noinline
wwieser at gmx dot de
gcc-bugzilla@gcc.gnu.org
Sun Aug 8 19:21:00 GMT 2004
Well, so this tricked me in some function call time measurements:
In the following code...
----------<test.cc>-----------------------------
int foo(int x) __attribute__((noinline));
int main()
{
for(int i=0; i<0x7fffffff; i++)
foo(i);
}
int foo(int x) { return(x); }
------------------------------------------------
...the function foo() actually gets inlined when compiled with
g++ -O2 -fno-rtti -fno-exceptions test.cc -o test.S
as can be seen in the produced assembler code
[...]
main:
pushl %ebp
xorl %eax, %eax
movl %esp, %ebp
subl $8, %esp
andl $-16, %esp
subl $16, %esp
.p2align 4,,15
.L6: <-- loop start
incl %eax
cmpl $2147483647, %eax
jne .L6 <-- loop end
[...]
The "call foo" is missing and got optimized away.
Version in question:
ggc (GCC) 3.4.2 20040808 (prerelease)
Wolfgang
--
Summary: gcc inlines functions with attribute noinline
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: wwieser at gmx dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-linux-gnu
GCC host triplet: i686-linux-gnu
GCC target triplet: i686-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16922
More information about the Gcc-bugs
mailing list