This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
-O3 -fno-default-inline
- To: gcc bug list <gcc-bugs at gcc dot gnu dot org>
- Subject: -O3 -fno-default-inline
- From: Martin Sebor <sebor at roguewave dot com>
- Date: Sat, 03 Feb 2001 21:29:33 -0700
- Organization: Rogue Wave Software, Inc.
Hi,
I'm curious whether this combination of flags is not inlining trivial members of
class templates (or member template functions of ordinary classes) by design or
whether it's a bug. Members of ordinary classes imlicitly declared inline are
inlined at -O3 so I would expect templates to be treated the same.
Thanks
Martin
$ cat t.cpp
struct S
{
void foo () { }
template <class T>
void bar () { }
};
int main ()
{
S().foo ();
S().bar<int>();
}
$ g++ t.cpp -g -O3 -fno-default-inline && echo "disas main" | gdb -q a.out
(gdb) Dump of assembler code for function main:
0x80487e0 <main>: pushl %ebp
0x80487e1 <main+1>: movl %esp,%ebp
0x80487e3 <main+3>: subl $0x14,%esp
0x80487e6 <main+6>: leal 0xfffffffe(%ebp),%edx
0x80487e9 <main+9>: movb $0x0,0xfffffffe(%ebp)
0x80487ed <main+13>: movb $0x0,0xffffffff(%ebp)
0x80487f1 <main+17>: pushl %edx
0x80487f2 <main+18>: call 0x8048860 <_ZN1S3barIiEEvv>
0x80487f7 <main+23>: addl $0x10,%esp
0x80487fa <main+26>: xorl %eax,%eax
0x80487fc <main+28>: movl %ebp,%esp
0x80487fe <main+30>: popl %ebp
0x80487ff <main+31>: ret