public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "zsojka at seznam dot cz" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/53705] New: wrong code with custom flags - stores to memory are lost
Date: Sun, 17 Jun 2012 12:20:00 -0000	[thread overview]
Message-ID: <bug-53705-4@http.gcc.gnu.org/bugzilla/> (raw)

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.


             reply	other threads:[~2012-06-17 12:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-17 12:20 zsojka at seznam dot cz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-53705-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).