diff mbox

Fix PR78312

Message ID alpine.LSU.2.11.1611141128030.5294@t29.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Nov. 14, 2016, 10:28 a.m. UTC
backprop changes values of SSA names - while it properly handles
debug info it fails to reset range/align info.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2016-11-14  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/78312
	* gimple-ssa-backprop.c (backprop::prepare_change): Reset
	flow-sensitive info.

	* gcc.dg/torture/pr78312.c: New testcase.
diff mbox

Patch

Index: gcc/gimple-ssa-backprop.c
===================================================================
--- gcc/gimple-ssa-backprop.c	(revision 242066)
+++ gcc/gimple-ssa-backprop.c	(working copy)
@@ -728,6 +728,7 @@  backprop::prepare_change (tree var)
 {
   if (MAY_HAVE_DEBUG_STMTS)
     insert_debug_temp_for_var_def (NULL, var);
+  reset_flow_sensitive_info (var);
 }
 
 /* STMT has been changed.  Give the fold machinery a chance to simplify
Index: gcc/testsuite/gcc.dg/torture/pr78312.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr78312.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr78312.c	(working copy)
@@ -0,0 +1,23 @@ 
+/* { dg-do run } */
+
+typedef unsigned short u16;
+
+static u16 a;
+
+u16 __attribute__ ((noinline, noclone))
+foo (int p1)
+{
+  a = -(p1 > 0);
+  a *= 0 != a;
+  a *= (unsigned)a;
+  return a;
+}
+
+int
+main ()
+{
+  u16 x = foo (1);
+  if (x != 1)
+    __builtin_abort();
+  return 0;
+}