From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19445 invoked by alias); 12 Aug 2014 12:17:02 -0000 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 Received: (qmail 19310 invoked by uid 48); 12 Aug 2014 12:16:50 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/62025] [4.9/4.10 Regression] Miscompilation of openssl sha512.c Date: Tue, 12 Aug 2014 12:17:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 4.9.1 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.2 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-08/txt/msg00760.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62025 --- Comment #15 from Jakub Jelinek --- So, what about this completely untested fix? Unfortunately the scheduler change has been committed with no testcases. I guess I'll do a bootstrap/regtest with some printout where this patch changes things and where we consider it at all. --- gcc/sched-deps.c.jj 2014-08-06 10:34:13.000000000 +0200 +++ gcc/sched-deps.c 2014-08-12 14:12:06.625193731 +0200 @@ -4751,6 +4751,24 @@ find_inc (struct mem_inc_info *mii, bool "inc conflicts with store failure.\n"); goto next; } + + /* The inc instruction could have clobbers, make sure those + registers are not used in mem insn. */ + FOR_EACH_INSN_DEF (def, mii->inc_insn) + if (!reg_overlap_mentioned_p (DF_REF_REG (def), mii->mem_reg0)) + { + df_ref use; + FOR_EACH_INSN_USE (use, mii->mem_insn) + if (reg_overlap_mentioned_p (DF_REF_REG (def), + DF_REF_REG (use))) + { + if (sched_verbose >= 5) + fprintf (sched_dump, + "inc clobber used in store failure.\n"); + goto next; + } + } + newaddr = mii->inc_input; if (mii->mem_index != NULL_RTX) newaddr = gen_rtx_PLUS (GET_MODE (newaddr), newaddr,