From patchwork Mon Apr 22 14:30:47 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 238543 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 44D972C0126 for ; Tue, 23 Apr 2013 00:31:01 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=fhA/Q26m0fTB1NMNjCpI3ilgtkOytAgxv0IOExVuGJJD3f yHcXRi1n0xeJdhlwNU3iMGrHmvSs1pOvW1RYzFPxhzgKXO/TUYXFBD8rMMJwMDiF O3i/wa+X8UBK7OISWfEYcJuF5B0OQPjeoMKIBMfUCTsIBKwN65A/Sis3cWClw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=EgiUZDVOn68PoU4idlC8Ypsb5qk=; b=Q4CC7Jtu8GTD7hdPHW9m 1Xvi2SlM4rF8WD6WHO/3NrtI7LmmwAeaPtQXiXXKwz3rNSrJQVIqSRbfSqcVkPw3 6bI7pSCvL/HNb9utof/dc2YVpw+tmQ6hwJ8R5r99tKPkqw5BAR5GgB5S1imUueTm dSRvUJJ0FgE4QETLaK5Bpc4= Received: (qmail 7588 invoked by alias); 22 Apr 2013 14:30:54 -0000 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 Received: (qmail 7579 invoked by uid 89); 22 Apr 2013 14:30:54 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Mon, 22 Apr 2013 14:30:53 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3MEUqCq005413 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 22 Apr 2013 10:30:52 -0400 Received: from Mair.local (vpn-48-120.rdu2.redhat.com [10.10.48.120]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3MEUoxS006892 for ; Mon, 22 Apr 2013 10:30:51 -0400 Message-ID: <51754997.2010008@redhat.com> Date: Mon, 22 Apr 2013 10:30:47 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 MIME-Version: 1.0 To: GCC Patches Subject: patch to fix PR57018 X-Virus-Found: No The following patch fixes http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57018 The patch was successfully bootstrapped and tested on x86/x86-64 (with different options). Committed as rev. 198140. 2013-04-22 Vladimir Makarov PR target/57018 * lra-eliminations.c (mark_not_eliminable): Prevent elimination of a set sp if no stack realignment. 2013-04-22 Vladimir Makarov PR target/57018 * gcc.target/i386/pr57018.c: New test. Index: lra-eliminations.c =================================================================== --- lra-eliminations.c (revision 198092) +++ lra-eliminations.c (working copy) @@ -716,7 +716,9 @@ mark_not_eliminable (rtx x) ep++) if (ep->to_rtx == SET_DEST (x) && SET_DEST (x) != hard_frame_pointer_rtx - && (GET_CODE (SET_SRC (x)) != PLUS + && (! (SUPPORTS_STACK_ALIGNMENT && stack_realign_fp + && REGNO (ep->to_rtx) == STACK_POINTER_REGNUM) + || 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/pr57018.c =================================================================== --- testsuite/gcc.target/i386/pr57018.c (revision 0) +++ testsuite/gcc.target/i386/pr57018.c (working copy) @@ -0,0 +1,31 @@ +/* { dg-do run } */ +/* { dg-options "-Os -fomit-frame-pointer -fno-asynchronous-unwind-tables" } */ +/* { dg-additional-options "-march=i686" { target ia32 } } */ + +struct A { char a[16]; } a; + +void __attribute__((noinline, noclone)) +foo (struct A b) +{ + if (__builtin_memcmp (b.a, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0", 16)) + __builtin_abort (); + asm volatile ("" : : : "memory"); +} + +void __attribute__((noinline, noclone)) +bar (struct A b) +{ + foo (a); + a = b; +} + +int +main () +{ + struct A b = { "\0\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17" }; + bar (b); + if (__builtin_memcmp (a.a, b.a, 16)) + __builtin_abort (); + return 0; +} +