This fixes an ICE in SCCVN - not sure how we got away with not clearing
new slots...  possibly SSA name recycling triggered.

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

Richard.

2015-10-06  Richard Biener  <rguent...@suse.de>

        PR tree-optimization/67859
        * tree-ssa-sccvn.c (VN_INFO_GET): Clear new entries.

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

Index: gcc/tree-ssa-sccvn.c
===================================================================
--- gcc/tree-ssa-sccvn.c        (revision 228514)
+++ gcc/tree-ssa-sccvn.c        (working copy)
@@ -407,7 +407,7 @@ VN_INFO_GET (tree name)
   newinfo = XOBNEW (&vn_ssa_aux_obstack, struct vn_ssa_aux);
   memset (newinfo, 0, sizeof (struct vn_ssa_aux));
   if (SSA_NAME_VERSION (name) >= vn_ssa_aux_table.length ())
-    vn_ssa_aux_table.safe_grow (SSA_NAME_VERSION (name) + 1);
+    vn_ssa_aux_table.safe_grow_cleared (SSA_NAME_VERSION (name) + 1);
   vn_ssa_aux_table[SSA_NAME_VERSION (name)] = newinfo;
   return newinfo;
 }

Index: gcc/testsuite/gcc.dg/torture/pr67859.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr67859.c      (revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr67859.c      (working copy)
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+int a, b, c;
+
+void
+fn1 ()
+{
+  b = c ? 0 : 1 << a;
+  b |= 0x9D7A5FD9;
+  for (;;)
+    {
+      int d = 1;
+      b &= (unsigned) d;
+    }
+}

Reply via email to