re PR tree-optimization/78312 (wrong code due to ssa-backprop)
authorRichard Biener <rguenther@suse.de>
Mon, 14 Nov 2016 10:33:15 +0000 (10:33 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 14 Nov 2016 10:33:15 +0000 (10:33 +0000)
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.

From-SVN: r242380

gcc/ChangeLog
gcc/gimple-ssa-backprop.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr78312.c [new file with mode: 0644]

index 5c53b9bf271ec4e6891103e01cbaf9e29f6b4069..a4f6a34f8f15c2db53aa6fd8cb1fb8324c93ee95 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/78312
+       * gimple-ssa-backprop.c (backprop::prepare_change): Reset
+       flow-sensitive info.
+
 2016-11-14  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/78093
index 53349e89658ef1af85a4afe332fc4ca7ed295cc4..6ef221817f9f4ee8ab0239efa03d8184155908d6 100644 (file)
@@ -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 b87788eaf16681e3f205721e66bb0b3e3cc20701..bf99ab981b9ac2a9477e7feb3ab052a25b44819f 100644 (file)
@@ -1,3 +1,8 @@
+2016-11-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/78312
+       * gcc.dg/torture/pr78312.c: New testcase.
+
 2016-11-14  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/78093
diff --git a/gcc/testsuite/gcc.dg/torture/pr78312.c b/gcc/testsuite/gcc.dg/torture/pr78312.c
new file mode 100644 (file)
index 0000000..470e5b2
--- /dev/null
@@ -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;
+}