public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/13081] New: [3.3 regression] forward template declarations in <complex> let inlining fail
@ 2003-11-17  0:06 debian-gcc at lists dot debian dot org
  2003-11-17  0:52 ` [Bug c++/13081] [3.3/3.4 " pinskia at gcc dot gnu dot org
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: debian-gcc at lists dot debian dot org @ 2003-11-17  0:06 UTC (permalink / raw)
  To: gcc-bugs

[ 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2004-01-02 11:42 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-17  0:06 [Bug libstdc++/13081] New: [3.3 regression] forward template declarations in <complex> let inlining fail debian-gcc at lists dot debian dot org
2003-11-17  0:52 ` [Bug c++/13081] [3.3/3.4 " pinskia at gcc dot gnu dot org
2003-12-16 21:32 ` pinskia at gcc dot gnu dot org
2003-12-25  1:34 ` pinskia at gcc dot gnu dot org
2003-12-25 17:52 ` pinskia at gcc dot gnu dot org
2003-12-25 17:54 ` pinskia at gcc dot gnu dot org
2003-12-29  2:44 ` cvs-commit at gcc dot gnu dot org
2003-12-29  5:32 ` [Bug c++/13081] [3.3 " mmitchel at gcc dot gnu dot org
2003-12-29 17:08 ` doko at cs dot tu-berlin dot de
2004-01-01  0:22 ` gdr at integrable-solutions dot net
2004-01-02 11:15 ` cvs-commit at gcc dot gnu dot org
2004-01-02 11:42 ` debian-gcc at lists dot debian dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).