[Bug c++/49519] [4.7 Regression] Revision 175272 miscompiled 447.dealII in SPEC CPU 2006

kirill.yukhin at intel dot com gcc-bugzilla@gcc.gnu.org
Wed Jun 29 12:25:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49519

--- Comment #5 from Yukhin Kirill <kirill.yukhin at intel dot com> 2011-06-29 12:24:25 UTC ---
Problem here is that GCC incorrectly stores arguments to stack in case of
tail-call opt.
Here is snippet
        movl    40(%esp), %eax
        movl    %eax, 28(%esp)
        movl    36(%esp), %esi
        movl    %esi, 24(%esp)
        movl    32(%esp), %esi
        movl    %esi, 20(%esp)
        movl    %eax, 16(%esp)

Argument from 28(%esp) is not copied to 28(%esp) at all.
Correct sequence must be (semantically) like that:
        movl    40(%esp), %esi ; <----- Use esi to move memory
        movl    28(%esp), %eax ; <----- Save overlapping value
        movl    %esi, 28(%esp)
        movl    36(%esp), %esi
        movl    %esi, 24(%esp)
        movl    32(%esp), %esi
        movl    %esi, 20(%esp)
        movl    %eax, 16(%esp) ; <----- Store saved value

Working toward the patch



More information about the Gcc-bugs mailing list