public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/53705] New: wrong code with custom flags - stores to memory are lost
@ 2012-06-17 12:20 zsojka at seznam dot cz
  2012-06-17 15:21 ` [Bug rtl-optimization/53705] " matz at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: zsojka at seznam dot cz @ 2012-06-17 12:20 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 53705
           Summary: wrong code with custom flags - stores to memory are
                    lost
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: zsojka@seznam.cz


Created attachment 27640
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27640
reduced testcase (from testsuite/gcc.c-torture/execute/loop-2e.c)

GCC 4.3-4.8 fails, while with GCC 4.2, the code is reduced just to return 0. I
am not sure if this should be marked as a regression.

Compiler output:
$ gcc -O2 -fno-omit-frame-pointer -fpeel-loops -fsched2-use-superblocks
-fno-tree-loop-optimize -fno-web --param=max-completely-peel-times=256
testcase.c
$ ./a.out
Aborted

Looking at the assembly:
...
    sub    rsp, 320    #,
    mov    rdx, QWORD PTR p[rip]    # p.0, p
    lea    rcx, [rbp-320]    # q,
...
    mov    QWORD PTR [rcx+240], rdi    # *q_19, tmp73
    lea    rax, [rdx+144]    # tmp73,
    lea    rsi, [rdx+148]    # tmp73,
    lea    rdi, [rdx+152]    # tmp73,
    lea    rdx, [rdx+156]    # tmp73,
    cmp    QWORD PTR [rbp-8], rdx    # q, tmp73
    mov    QWORD PTR [rcx+280], rax    # *q_19, tmp73
    mov    QWORD PTR [rcx+248], r8    # *q_19, tmp73
    mov    QWORD PTR [rcx+256], r9    # *q_19, tmp73
    mov    QWORD PTR [rcx+264], r10    # *q_19, tmp73
    mov    QWORD PTR [rcx+272], r11    # *q_19, tmp73
    mov    QWORD PTR [rcx+288], rsi    # *q_19, tmp73
    mov    QWORD PTR [rcx+296], rdi    # *q_19, tmp73
    mov    QWORD PTR [rcx+304], rdx    # *q_19, tmp73
    jne    .L46    #,
...
It seems the dependency between storing to *q++ (esp. q[39]) in foo() and
verifying it in main() is lost. Furthermore, it seems q[39] ([rcx+312]) is not
stored to at all.


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

end of thread, other threads:[~2013-07-30 13:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-17 12:20 [Bug rtl-optimization/53705] New: wrong code with custom flags - stores to memory are lost zsojka at seznam dot cz
2012-06-17 15:21 ` [Bug rtl-optimization/53705] " matz at gcc dot gnu.org
2012-06-17 15:36 ` matz at gcc dot gnu.org
2012-06-17 17:43 ` pinskia at gcc dot gnu.org
2013-07-30 13:37 ` amylaar at gcc dot gnu.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).