This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/17481] Dead temporaries saved across function calls
- From: "giovannibajo at libero dot it" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Sep 2004 18:15:17 -0000
- Subject: [Bug c++/17481] Dead temporaries saved across function calls
- References: <20040914171419.17481.benoitsevigny@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From giovannibajo at libero dot it 2004-09-14 18:15 -------
With 4.0.0, with -O3 -DINLINE_FCALL, we get:
_Z4testRK9aggregateS1_S1_:
pushl %ebp
movl %esp, %ebp
movl 8(%ebp), %eax
movl 12(%ebp), %edx
flds (%edx)
movl 16(%ebp), %edx
flds (%edx)
movl 20(%ebp), %edx
flds (%edx)
fld %st(2)
fadd %st(2), %st
fmul %st(1), %st
fld %st(3)
fadd %st(2), %st
fmul %st(3), %st
fxch %st(3)
faddp %st, %st(2)
fxch %st(3)
fmulp %st, %st(1)
faddp %st, %st(1)
faddp %st, %st(1)
fstps (%eax)
leave
ret $4
Notice that the code is more optimized, and the unused stack space is gone.
With simply -O3, we get:
_Z4testRK9aggregateS1_S1_:
pushl %ebp
movl %esp, %ebp
pushl %ebx
subl $16, %esp
movl 8(%ebp), %ebx
movl 12(%ebp), %eax
flds (%eax)
movl 16(%ebp), %eax
flds (%eax)
movl 20(%ebp), %eax
flds (%eax)
fld %st(2)
fadd %st(2), %st
fmul %st(1), %st
fld %st(3)
fadd %st(2), %st
fmul %st(3), %st
fxch %st(3)
faddp %st, %st(2)
fxch %st(3)
fmulp %st, %st(1)
faddp %st, %st(1)
faddp %st, %st(1)
fstps -8(%ebp)
leal -8(%ebp), %eax
pushl %eax
pushl %ebx
call _Z5fcallRK9aggregate
movl %ebx, %eax
movl -4(%ebp), %ebx
leave
ret $4
where all the useless code is gone.
This is another good example of how 4.0 does miracles with C++ code, thanks to
the brand new tree optimizers. I close this bug as fixed in 4.0, as obviously
it will not be fixed in any previous version.
Thanks for the report.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Known to fail| |3.3.1
Known to work| |4.0.0
Resolution| |FIXED
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17481