From patchwork Sun Nov 21 19:02:23 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 72452 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 1E7EDB7147 for ; Mon, 22 Nov 2010 06:02:35 +1100 (EST) Received: (qmail 2590 invoked by alias); 21 Nov 2010 19:02:33 -0000 Received: (qmail 2582 invoked by uid 22791); 21 Nov 2010 19:02:32 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, TW_ZJ X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 21 Nov 2010 19:02:27 +0000 Received: by pvd12 with SMTP id 12so1497143pvd.20 for ; Sun, 21 Nov 2010 11:02:25 -0800 (PST) MIME-Version: 1.0 Received: by 10.142.199.19 with SMTP id w19mr3840896wff.390.1290366143362; Sun, 21 Nov 2010 11:02:23 -0800 (PST) Received: by 10.143.161.2 with HTTP; Sun, 21 Nov 2010 11:02:23 -0800 (PST) In-Reply-To: References: Date: Sun, 21 Nov 2010 20:02:23 +0100 Message-ID: Subject: Re: [PATCH, middle-end]: Fix PR 43057, [LTO] fold check: original tree changed by fold From: Uros Bizjak To: Richard Guenther Cc: gcc-patches@gcc.gnu.org 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 On Sun, Nov 21, 2010 at 7:43 PM, Richard Guenther wrote: > On Sat, Nov 20, 2010 at 8:03 PM, Uros Bizjak wrote: >> Hello! >> >> Attached patch fixes PR 43057 by unsharing arg0 argument. >> >> 2010-11-20  Uros Bizjak   >> >>        PR middle-end/43057 >>        * fold-const.c (fold_ternary_loc) : Unshare arg0 when >>        converting A ? 1 : 0 to A. >> >> Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu >> {,-m32}. FWIW, "--enable-checking=all" bootstrap is still running and >> it already compiled up to stage-2 gcc/dse.o. I will leave the >> bootstrap overnight to see if it breaks (it probably won't). >> >> OK for mainline and 4.5? > > Ok. Actually, --enable-checking=all build broke in fold-const.c, line 13361 (trying to build libstdc++/src/debug.cc) in the same call to pedantic_non_lvalue_loc. This points to the problem in the called function itself. Attached patch unshares the expression in the pedantic_non_lvalue_loc itself. We shouldn't change the original operand by setting the location. 2010-11-21 Uros Bizjak PR middle-end/43057 * fold-const.c (pedantic_non_lvalue_loc): Unshare x before setting location. OK for mainline and 4.5? Uros. Index: fold-const.c =================================================================== --- fold-const.c (revision 166974) +++ fold-const.c (working copy) @@ -2097,6 +2097,7 @@ { if (pedantic_lvalues) return non_lvalue_loc (loc, x); + x = unshare_expr (x); protected_set_expr_location (x, loc); return x; }