This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, middle-end]: Fix PR 43057, [LTO] fold check: original tree changed by fold


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]