re PR debug/17389 (ICE in dwarf2out_finish, at dwarf2out.c:13566)
authorJan Hubicka <jh@suse.cz>
Thu, 23 Sep 2004 00:51:40 +0000 (02:51 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 23 Sep 2004 00:51:40 +0000 (00:51 +0000)
PR debug/17389
* dwarf2out.c (dwarf2out_finish): Deal with nested functions
of fully inlined functions.
* tree-inline.c (inline_forbidden_p_1): Nested functions can be
inlined.

From-SVN: r87911

gcc/ChangeLog
gcc/dwarf2out.c
gcc/tree-inline.c

index 5ece63e9e3ac527c3025e2dcb3d93341c3e1dded..ffbdcfb9edab38c71312df20ba2d7a1751e52cc2 100644 (file)
@@ -1,5 +1,11 @@
 2004-09-23  Jan Hubicka  <jh@suse.cz>
 
+       PR debug/17389
+       * dwarf2out.c (dwarf2out_finish): Deal with nested functions
+       of fully inlined functions.
+       * tree-inline.c (inline_forbidden_p_1): Nested functions can be
+       inlined.
+
        * cfgexpand.c (add_reg_br_prob_note): New function.
        (expand_gimple_cond_expr): Use it.
        (tree_expand_cfg): No longer kill the profile.
index e269629d9d2a94f8f1e1eba69accc526fe1ebcd9..3c47864c85b86b6a8d5327453c3c14c3b7d330be 100644 (file)
@@ -13554,7 +13554,12 @@ dwarf2out_finish (const char *filename)
                 nested function can be optimized away, which results
                 in the nested function die being orphaned.  Likewise
                 with the return type of that nested function.  Force
-                this to be a child of the containing function.  */
+                this to be a child of the containing function.
+
+                It may happen that even the containing function got fully
+                inlined and optimized out.  In that case we are lost and
+                assign the empty child.  This should not be big issue as
+                the function is likely unreachable too.  */
              tree context = NULL_TREE;
 
              gcc_assert (node->created_for);
@@ -13567,8 +13572,8 @@ dwarf2out_finish (const char *filename)
              gcc_assert (context && TREE_CODE (context) == FUNCTION_DECL);
              
              origin = lookup_decl_die (context);
-             gcc_assert (origin);
-             add_child_die (origin, die);
+             if (origin)
+               add_child_die (origin, die);
            }
        }
     }
index 243b870cf7026b33cd1d6440f3d5f47c527daced..d026dca18ecf7687b744befc64dd6d2f1d149f0d 100644 (file)
@@ -993,20 +993,6 @@ inline_forbidden_p_1 (tree *nodep, int *walk_subtrees ATTRIBUTE_UNUSED,
          }
       break;
 
-    case BIND_EXPR:
-      for (t = BIND_EXPR_VARS (node); t ; t = TREE_CHAIN (t))
-       {
-          /* We cannot inline functions that contain other functions.  */
-         if (TREE_CODE (t) == FUNCTION_DECL && DECL_INITIAL (t))
-           {
-             inline_forbidden_reason
-               = N_("%Jfunction '%F' can never be inlined "
-                    "because it contains a nested function");
-             return node;
-           }
-       }
-      break;
-
     case GOTO_EXPR:
       t = TREE_OPERAND (node, 0);