Assert no use with SSA_NAME_IN_FREELIST before using freelist.
authorTom de Vries <tom@codesourcery.com>
Thu, 16 Oct 2014 12:42:41 +0000 (12:42 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Thu, 16 Oct 2014 12:42:41 +0000 (12:42 +0000)
2014-10-16  Tom de Vries  <tom@codesourcery.com>

* tree-into-ssa.c (update_ssa): Assert that there's no ssa use operand
with SSA_NAME_IN_FREELIST.

From-SVN: r216318

gcc/ChangeLog
gcc/tree-into-ssa.c

index 9d817c1b24a3cfeb2666a806e6f0a92947fd887e..5f398d3b940eb89dd5b90f85c80d816683f17fd3 100644 (file)
@@ -1,3 +1,8 @@
+2014-10-16  Tom de Vries  <tom@codesourcery.com>
+
+       * tree-into-ssa.c (update_ssa): Assert that there's no ssa use operand
+       with SSA_NAME_IN_FREELIST.
+
 2014-10-16  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/63554
index 01203dece183b52cbbaf6c2dcfffaa2d1cb0b080..f1983f1ac7306916c6f56b6acae9c3af03eb31ed 100644 (file)
@@ -3161,6 +3161,45 @@ update_ssa (unsigned update_flags)
   if (!need_ssa_update_p (cfun))
     return;
 
+#ifdef ENABLE_CHECKING
+  timevar_push (TV_TREE_STMT_VERIFY);
+
+  bool err = false;
+
+  FOR_EACH_BB_FN (bb, cfun)
+    {
+      gimple_stmt_iterator gsi;
+      for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+       {
+         gimple stmt = gsi_stmt (gsi);
+
+         ssa_op_iter i;
+         use_operand_p use_p;
+         FOR_EACH_SSA_USE_OPERAND (use_p, stmt, i, SSA_OP_ALL_USES)
+           {
+             tree use = USE_FROM_PTR (use_p);
+             if (TREE_CODE (use) != SSA_NAME)
+               continue;
+
+             if (SSA_NAME_IN_FREE_LIST (use))
+               {
+                 error ("statement uses released SSA name:");
+                 debug_gimple_stmt (stmt);
+                 fprintf (stderr, "The use of ");
+                 print_generic_expr (stderr, use, 0);
+                 fprintf (stderr," should have been replaced\n");
+                 err = true;
+               }
+           }
+       }
+    }
+
+  if (err)
+    internal_error ("cannot update SSA form");
+
+  timevar_pop (TV_TREE_STMT_VERIFY);
+#endif
+
   timevar_push (TV_TREE_SSA_INCREMENTAL);
 
   if (dump_file && (dump_flags & TDF_DETAILS))