From patchwork Tue Nov 27 09:14:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 202131 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 1441E2C0086 for ; Tue, 27 Nov 2012 20:18:20 +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=1354612702; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Date: From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=DvDRZtjpvByLeX09MQs1 nHMWaz0=; b=EQbXS7cATDCeum+4I+dFTWHfd5VrqZzksVj4fn69DcWcK88J/zLk kWvCC25T2fLSqhSRO5R5Tcg5vQ/LWtCgqwrc2QqF/Yt9OOBz71uo8B752izACN3I fhVIbc+mH+vjrFACXskfg6rT75gRLiYaETxs96Gc8oxDp7qR5xxP9g4= 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:Date:From:To:Subject:Message-ID:User-Agent:MIME-Version:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=xlQ/Iusz5fj5/aONU/7KFmth9OcrhvSh17tSDn/JCKRMGRi++dqf7gDlQjKrvF kOhCJvqwCznT55vU3YrKZrw6/jjcQC5fKyrVJFtbmUgZ+o+AObVpz4joEa7mPX4L VJxRr1Tup3M3KS2ksSbA4Dwc7a7xxcW+EOAXeFLL2/ryg=; Received: (qmail 32318 invoked by alias); 27 Nov 2012 09:18:13 -0000 Received: (qmail 32308 invoked by uid 22791); 27 Nov 2012 09:18:12 -0000 X-SWARE-Spam-Status: No, hits=-5.6 required=5.0 tests=AWL, BAYES_00, KHOP_RCVD_UNTRUST, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, TW_TM X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Nov 2012 09:18:08 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 0CF1498E46 for ; Tue, 27 Nov 2012 10:18:07 +0100 (CET) Date: Tue, 27 Nov 2012 10:14:04 +0100 (CET) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix PR55331 Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 This is an alternate fix for PR55331, bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2012-11-16 Richard Biener PR middle-end/55331 * gimple-fold.c (gimplify_and_update_call_from_tree): Replace stmt with a NOP instead of removing it. * g++.dg/opt/pr55331.C: New testcase. Index: gcc/gimple-fold.c =================================================================== --- gcc/gimple-fold.c (revision 193816) +++ gcc/gimple-fold.c (working copy) @@ -607,7 +607,7 @@ gimplify_and_update_call_from_tree (gimp unlink_stmt_vdef (stmt); release_defs (stmt); } - gsi_remove (si_p, true); + gsi_replace (si_p, gimple_build_nop (), true); return; } } Index: gcc/testsuite/g++.dg/opt/pr55331.C =================================================================== --- gcc/testsuite/g++.dg/opt/pr55331.C (revision 0) +++ gcc/testsuite/g++.dg/opt/pr55331.C (working copy) @@ -0,0 +1,14 @@ +// PR tree-optimization/55331 +// { dg-do compile } +// { dg-options "-O2 -fno-tree-fre" } + +struct A {}; + +void +foo (A *p, bool x) +{ + A a; + char *e = (char *) (&a + 1); + if (x) + __builtin_memmove (p, &a, e - (char *) &a); +}