This patch fixes a bug in exposed in LIPO build (ICE in copy tree node).

Tested with bookstrap and google internal benchmarks.

-Rong

2013-05-24  Rong Xu  <x...@google.com>
        Google ref b/8963414.
        * gcc/tree-inline.c (add_local_variables): Not map
        to deleted debug expression.

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c   (revision 199128)
+++ gcc/tree-inline.c   (working copy)
@@ -3788,6 +3788,17 @@ add_local_variables (struct function *callee, stru
          {
            tree tem = DECL_DEBUG_EXPR (var);
            bool old_regimplify = id->regimplify;
+
+            /* The mapped debug expression might be deleted
+               as a varpool node (the reachbility analysis
+               of varpool node does not check the reference
+               from debug expressions.
+               Set it to 0 if that's the case.  */
+            if (L_IPO_COMP_MODE && tem &&
+                (TREE_STATIC (tem) || DECL_EXTERNAL(tem)) &&
+                real_varpool_node (tem) == NULL)
+              tem = NULL;
+
            id->remapping_type_depth++;
            walk_tree (&tem, copy_tree_body_r, id, NULL);
            id->remapping_type_depth--;

--
This patch is available for review at http://codereview.appspot.com/9760043

Reply via email to