public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Richard Guenther <richard.guenther@gmail.com>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH, middle-end]: Fix PR 43057, [LTO] fold check: original tree changed by fold
Date: Sun, 21 Nov 2010 21:49:00 -0000	[thread overview]
Message-ID: <AANLkTi=UHGM2JDihLE6+cdz9EMod6-4VWPjBjCBn6YXJ@mail.gmail.com> (raw)
In-Reply-To: <AANLkTinFakwF7FLA7i35cogO1Wer_5Ti8UH=gPbADB02@mail.gmail.com>

On Sun, Nov 21, 2010 at 7:43 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Sat, Nov 20, 2010 at 8:03 PM, Uros Bizjak <ubizjak@gmail.com> wrote:
>> Hello!
>>
>> Attached patch fixes PR 43057 by unsharing arg0 argument.
>>
>> 2010-11-20  Uros Bizjak  <ubizjak@gmail.com>
>>
>>        PR middle-end/43057
>>        * fold-const.c (fold_ternary_loc) <COND_EXPR>: 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  <ubizjak@gmail.com>

	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;
 }

  reply	other threads:[~2010-11-21 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-20 19:51 Uros Bizjak
2010-11-21 20:49 ` Richard Guenther
2010-11-21 21:49   ` Uros Bizjak [this message]
2010-11-22  1:41     ` Richard Guenther
2010-11-22  2:01       ` Jakub Jelinek
2010-11-22  9:37         ` Uros Bizjak
2010-11-22  9:51           ` Jakub Jelinek
2010-11-22 12:47           ` Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='AANLkTi=UHGM2JDihLE6+cdz9EMod6-4VWPjBjCBn6YXJ@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=richard.guenther@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).