From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9280 invoked by alias); 3 Nov 2013 20:49:50 -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 8948 invoked by uid 48); 3 Nov 2013 20:47:48 -0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/58981] [4.9 Regression] FAIL: gcc.target/i386/memset-1.c execution test Date: Sun, 03 Nov 2013 20:49: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.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.9.0 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: 2013-11/txt/msg00141.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58981 --- Comment #2 from H.J. Lu --- The bug is in *count = expand_simple_binop (GET_MODE (*count), PLUS, *count, saveddest, *count, 1, OPTAB_DIRECT); (gdb) call debug_rtx (saveddest) (reg:SI 101) (gdb) call debug_rtx (*count) (reg:DI 100) (gdb) Add SImode address to DImode count to update count leads to count overflow. Instead, we should use mode of address here: diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 902e169..b27bfb6 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -23139,7 +23139,7 @@ expand_set_or_movmem_prologue_epilogue_by_misaligned_moves (rtx destmem, rtx src if (!issetmem) *srcptr = expand_simple_binop (GET_MODE (*srcptr), MINUS, *srcptr, saveddest, *srcptr, 1, OPTAB_DIRECT); - *count = expand_simple_binop (GET_MODE (*count), PLUS, *count, + *count = expand_simple_binop (GET_MODE (saveddest), PLUS, *count, saveddest, *count, 1, OPTAB_DIRECT); /* We copied at most size + prolog_size. */ if (*min_size > (unsigned HOST_WIDE_INT)(size + prolog_size))