public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, middle-end]: Fix PR 43057, [LTO] fold check: original tree changed by fold
@ 2010-11-20 19:51 Uros Bizjak
  2010-11-21 20:49 ` Richard Guenther
  0 siblings, 1 reply; 8+ messages in thread
From: Uros Bizjak @ 2010-11-20 19:51 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 523 bytes --]

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?

Uros.

[-- Attachment #2: p.diff.txt --]
[-- Type: text/plain, Size: 621 bytes --]

Index: fold-const.c
===================================================================
--- fold-const.c	(revision 166974)
+++ fold-const.c	(working copy)
@@ -13415,7 +13415,7 @@ fold_ternary_loc (location_t loc, enum t
 	     a COND, which will recurse.  In that case, the COND_EXPR
 	     is probably the best choice, so leave it alone.  */
 	  && type == TREE_TYPE (arg0))
-	return pedantic_non_lvalue_loc (loc, arg0);
+	return pedantic_non_lvalue_loc (loc, unshare_expr (arg0));
 
       /* Convert A ? 0 : 1 to !A.  This prefers the use of NOT_EXPR
 	 over COND_EXPR in cases such as floating point comparisons.  */

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-11-22 10:48 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-20 19:51 [PATCH, middle-end]: Fix PR 43057, [LTO] fold check: original tree changed by fold Uros Bizjak
2010-11-21 20:49 ` Richard Guenther
2010-11-21 21:49   ` Uros Bizjak
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

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).