This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: c++/8826: "a >> b" differs from "a.operator>>(b)" in that virtual function calls are not avoided


Synopsis: "a >> b" differs from "a.operator>>(b)" in that virtual function calls are not avoided

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Thu Dec  5 11:34:07 2002
State-Changed-Why:
    Confirmed. This is a very annoying bug, which would be nice
    if someone looked at it soon, since there should really
    be no reason why the two calls are treated differently; this
    raises the question whether there are more _correctness_
    problems lurking somewhere. Note that the code uses
      a.operator>>(y)
    not
      a.A::operator>>(y)
    !
    
    In any case, removing the asm labels that only are there to
    help reading the asm code, the second function where the
    virtual function call is elided is compiled into
    	pushl	%ebp
    	movl	%esp, %ebp
    	subl	$24, %esp
    	movl	8(%ebp), %eax
    	movl	%ebp, %esp
    	popl	%ebp
    	incl	%eax
    	ret
    which is a far cry from optimal. Essentially, the computation
    of the function's value has been scheduled after the
    epilog, but then pro- and epilog could be merged and
    deleted. This is not done.
    
    Things are a little better with -fomit-frame-pointer:
    	subl	$28, %esp
    	movl	32(%esp), %eax
    	addl	$28, %esp
    	incl	%eax
    	ret
    but still not optimal.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8826


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]