public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR55331
@ 2012-11-27  9:18 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2012-11-27  9:18 UTC (permalink / raw)
  To: gcc-patches


This is an alternate fix for PR55331, bootstrapped and tested on
x86_64-unknown-linux-gnu, applied.

Richard.

2012-11-16  Richard Biener  <rguenther@suse.de>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-27  9:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-27  9:18 [PATCH] Fix PR55331 Richard Biener

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