re PR tree-optimization/77979 (ICE on valid code at -Os and above on x86_64-linux...
authorRichard Biener <rguenther@suse.de>
Fri, 14 Oct 2016 12:58:18 +0000 (12:58 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 14 Oct 2016 12:58:18 +0000 (12:58 +0000)
2016-10-14  Richard Biener  <rguenther@suse.de>

PR tree-optimization/77979
* tree-vrp.c (compare_name_with_value): Handle released SSA names
in the equivalency sets.
(compare_names): Likewise.

* gcc.dg/torture/pr77979.c: New testcase.

From-SVN: r241162

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr77979.c [new file with mode: 0644]
gcc/tree-vrp.c

index e30217896e909679babb0b18b3a8bb5b3506fd5a..433c0cbdd6403002cfaa0db1983a46b3fc48d8de 100644 (file)
@@ -1,3 +1,10 @@
+2016-10-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77979
+       * tree-vrp.c (compare_name_with_value): Handle released SSA names
+       in the equivalency sets.
+       (compare_names): Likewise.
+
 2016-10-14  Martin Liska  <mliska@suse.cz>
 
        * builtins.h(target_char_cst_p): Declare the function.
index 51a521dfca9df4e74538ed470541ec58d6a5aea1..bc8471f63e4df367f7e3a047917de47894900f56 100644 (file)
@@ -1,3 +1,8 @@
+2016-10-14  Richard Biener  <rguenther@suse.de>
+
+       PR tree-optimization/77979
+       * gcc.dg/torture/pr77979.c: New testcase.
+
 2016-10-14  Martin Liska  <mliska@suse.cz>
 
        * gcc.dg/tree-ssa/builtins-folding-generic.c: New test.
diff --git a/gcc/testsuite/gcc.dg/torture/pr77979.c b/gcc/testsuite/gcc.dg/torture/pr77979.c
new file mode 100644 (file)
index 0000000..94addf4
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+
+int a, b, c, d, e, f;
+
+void fn1 ()
+{ 
+  int g = b;
+  a = -~(d || a) << 4 || e;
+  b = c || g ^ a;
+  if (f < g)
+    d = e;
+}
index 941c0fd34d816178be5f8ab3525d78e19c2fd61c..00a08fdff6dd123b53955d3308e7f6c6a86b5ba5 100644 (file)
@@ -7188,9 +7188,13 @@ compare_name_with_value (enum tree_code comp, tree var, tree val,
 
   EXECUTE_IF_SET_IN_BITMAP (e, 0, i, bi)
     {
+      tree name = ssa_name (i);
+      if (! name)
+       continue;
+
       if (! use_equiv_p
-         && ! SSA_NAME_IS_DEFAULT_DEF (ssa_name (i))
-         && prop_simulate_again_p (SSA_NAME_DEF_STMT (ssa_name (i))))
+         && ! SSA_NAME_IS_DEFAULT_DEF (name)
+         && prop_simulate_again_p (SSA_NAME_DEF_STMT (name)))
        continue;
 
       equiv_vr = get_vr_for_comparison (i);
@@ -7289,11 +7293,17 @@ compare_names (enum tree_code comp, tree n1, tree n2,
      of the loop just to check N1 and N2 ranges.  */
   EXECUTE_IF_SET_IN_BITMAP (e1, 0, i1, bi1)
     {
+      if (! ssa_name (i1))
+       continue;
+
       value_range vr1 = get_vr_for_comparison (i1);
 
       t = retval = NULL_TREE;
       EXECUTE_IF_SET_IN_BITMAP (e2, 0, i2, bi2)
        {
+         if (! ssa_name (i2))
+           continue;
+
          bool sop = false;
 
          value_range vr2 = get_vr_for_comparison (i2);