From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27465 invoked by alias); 17 Jun 2012 12:20:38 -0000 Received: (qmail 27457 invoked by uid 22791); 17 Jun 2012 12:20:37 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 17 Jun 2012 12:20:24 +0000 From: "zsojka at seznam dot cz" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: rtl-optimization X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg01106.txt.bz2 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.