------- Comment #43 from rguenth at gcc dot gnu dot org  2010-07-08 12:33 
-------
I placed a debug_generic_expr () in copy_node_stat and re-directed output ...

Now, I see that in the non-debug case we are copying the LABEL_DECL while
copying statements while in the debug case we are copying it while
copying the block tree.  We have to preserve used labels in
the block tree it's just not trivial to do unless we resort to setting
TREE_USED.

Which would be the following, which also fixes the failure.

Index: tree-ssa-live.c
===================================================================
--- tree-ssa-live.c     (revision 161949)
+++ tree-ssa-live.c     (working copy)
@@ -384,6 +384,9 @@ mark_all_vars_used_1 (tree *tp, int *wal
       set_is_used (t);
     }

+  if (TREE_CODE (t) == LABEL_DECL)
+    TREE_USED (t) = true;
+
   if (IS_TYPE_OR_DECL_P (t))
     *walk_subtrees = 0;

@@ -448,6 +451,13 @@ remove_unused_scope_block_p (tree scope)
       else if (TREE_CODE (*t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (*t))
        unused = false;

+      /* Labels that are still used in the IL we have to preserve in
+         the block tree as well, otherwise we risk having different
+        ordering in debug vs. non-debug builds during inlining
+        or versioning.  */
+      else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
+       unused = false;
+
       /* Remove everything we don't generate debug info for.  */
       else if (DECL_IGNORED_P (*t))
        {


we don't have var annotations for LABEL_DECLs, so a proper solution
would use a bitmap of UIDs to preserve here I guess.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44832

Reply via email to