From patchwork Thu Jan 10 20:01:51 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 211143 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id B2E582C00E1 for ; Fri, 11 Jan 2013 07:11:12 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1358453473; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:Subject: Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:Sender:Delivered-To; bh=B2uagmD G9Spr3HkBOQXYVPXgRyE=; b=kI+te7sDOZCHRwbB+hjbl8riof3AT1OaMu4gWpL TX/0PXuUIxIkauq2c1sF0RRZ2hwhTdNAl0aGQXwCJbI4A7MAjcz35I+q9FEZi/XX xmuAApblbgTth9KTZbMh533SgXL11v3dBdRrD81pP1qf98Dsdgeuob5tow6JJp7+ 4FQg= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:Subject:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=e6GMBsCllq5s1rGZg7u/2Ton76uhG3qXBrVi0FDD9t+NXkYnHPMfZopZs+e4Zq qWflRYLSZvW28WGMKBmlGENEzBedMC53SXJ310+DAroeAJccY/SI5KKC4YZXndTd MaU+UhvKEvx8rxhNtWuDidbWwuOH7Wp1dT74K30XC9RHM=; Received: (qmail 20898 invoked by alias); 10 Jan 2013 20:11:02 -0000 Received: (qmail 20875 invoked by uid 22791); 10 Jan 2013 20:10:59 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, MAY_BE_FORGED, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 Jan 2013 20:10:53 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r0AKAigE011271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 10 Jan 2013 15:10:46 -0500 Received: from toll.usersys.redhat.com (unused [10.15.16.165] (may be forged)) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r0AKAg3W023980 for ; Thu, 10 Jan 2013 15:10:44 -0500 Message-ID: <50EF1E2F.30300@redhat.com> Date: Thu, 10 Jan 2013 15:01:51 -0500 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: gcc-patches Subject: patch to fix PR55672 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55672 The patch was successfully tested and bootstrapped on x86-64 (with and without -fstack-check=generic). Committed as rev. 195095. 2013-01-10 Vladimir Makarov PR rtl-optimization/pr55672 * lra-eliminations.c (mark_not_eliminable): Permit addition with const to be eliminable. 2013-01-10 Vladimir Makarov PR rtl-optimization/pr55672 * gcc.target/i386/pr55672.c: New. Index: lra-eliminations.c =================================================================== --- lra-eliminations.c (revision 195058) +++ lra-eliminations.c (working copy) @@ -657,7 +657,7 @@ mark_not_eliminable (rtx x) case PRE_MODIFY: if (REG_P (XEXP (x, 0)) && REGNO (XEXP (x, 0)) < FIRST_PSEUDO_REGISTER) /* If we modify the source of an elimination rule, disable - it. Do the same if it is the source and not the hard frame + it. Do the same if it is the source and not the hard frame register. */ for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; @@ -716,7 +716,10 @@ mark_not_eliminable (rtx x) ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++) if (ep->to_rtx == SET_DEST (x) - && SET_DEST (x) != hard_frame_pointer_rtx) + && SET_DEST (x) != hard_frame_pointer_rtx + && (GET_CODE (SET_SRC (x)) != PLUS + || XEXP (SET_SRC (x), 0) != SET_DEST (x) + || ! CONST_INT_P (XEXP (SET_SRC (x), 1)))) setup_can_eliminate (ep, false); } Index: testsuite/gcc.target/i386/pr55672.c =================================================================== --- testsuite/gcc.target/i386/pr55672.c (revision 0) +++ testsuite/gcc.target/i386/pr55672.c (working copy) @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O -fstack-check=generic" } */ + +int main () +{ + int x[8]; + if (x[0] != 4) + __builtin_abort (); + return 0; +}