This adds verification code that we do not try to rewrite a symbol
into SSA form that is already partly in SSA form.  That would lead
to silent wrong-code generation.

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

Richard.

2012-08-14  Richard Guenther  <rguent...@suse.de>

        * tree-into-ssa.c (update_ssa): Verify we do not rename
        symbols that are already partly in SSA form.

Index: gcc/tree-into-ssa.c
===================================================================
--- gcc/tree-into-ssa.c (revision 190346)
+++ gcc/tree-into-ssa.c (working copy)
@@ -3247,6 +3247,30 @@ update_ssa (unsigned update_flags)
         statements and set local live-in information for the PHI
         placement heuristics.  */
       prepare_block_for_update (start_bb, insert_phi_p);
+
+#ifdef ENABLE_CHECKING
+      for (i = 1; i < num_ssa_names; ++i)
+       {
+         tree name = ssa_name (i);
+         if (!name
+             || virtual_operand_p (name))
+           continue;
+
+         /* For all but virtual operands, which do not have SSA names
+            with overlapping life ranges, ensure that symbols marked
+            for renaming do not have existing SSA names associated with
+            them as we do not re-write them out-of-SSA before going
+            into SSA for the remaining symbol uses.  */
+         if (marked_for_renaming (SSA_NAME_VAR (name)))
+           {
+             fprintf (stderr, "Existing SSA name for symbol marked for "
+                      "renaming: ");
+             print_generic_expr (stderr, name, TDF_SLIM);
+             fprintf (stderr, "\n");
+             internal_error ("SSA corruption");
+           }
+       }
+#endif
     }
   else
     {

Reply via email to