[Bug libstdc++/13081] New: [3.3 regression] forward template declarations in <complex> let inlining fail
debian-gcc at lists dot debian dot org
gcc-bugzilla@gcc.gnu.org
Mon Nov 17 00:06:00 GMT 2003
[ forwarded from http://bugs.debian.org/195264 ]
the bug submitter noticed, that std::conj() doesn't get inlined, as one'd expect
it to be, when compiling the following with -O2
template<typename T> T foo(T);
template<typename T> inline T foo(T t)
{
return t;
} // __attribute((always_inline))
long bar (long);
inline long bar (long l)
{
return l;
}
void doo (long &l)
{
l = foo (l);
l = bar (l);
}
Disassembly of section .text:
00000000 <doo(long&)>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 53 push %ebx
4: 83 ec 10 sub $0x10,%esp
7: 8b 5d 08 mov 0x8(%ebp),%ebx
a: ff 33 pushl (%ebx)
c: e8 fc ff ff ff call d <doo(long&)+0xd>
d: R_386_PC32 long foo<long>(long)
11: 89 03 mov %eax,(%ebx)
13: 83 c4 10 add $0x10,%esp
16: 8b 5d fc mov 0xfffffffc(%ebp),%ebx
19: c9 leave
1a: c3 ret
Disassembly of section .gnu.linkonce.t._Z3fooIlET_S0_:
00000000 <long foo<long>(long)>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 8b 45 08 mov 0x8(%ebp),%eax
6: c9 leave
7: c3 ret
i.e. bar get's inlined, but foo<long> does not... why?
btw, gcc-2.95 would optimize it into a NOP:
00000000 <doo(long &)>:
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: c9 leave
4: c3 ret
-- I'd say that's a regression...
--
Summary: [3.3 regression] forward template declarations in
<complex> let inlining fail
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libstdc++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13081
More information about the Gcc-bugs
mailing list