Index: cgraphunit.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/cgraphunit.c,v retrieving revision 1.68 diff -u -p -r1.68 cgraphunit.c --- cgraphunit.c 1 Jul 2004 07:51:11 -0000 1.68 +++ cgraphunit.c 9 Jul 2004 11:32:00 -0000 @@ -770,7 +770,7 @@ cgraph_mark_functions_to_output (void) node->output = 1; /* We should've reclaimed all functions that are not needed. */ else if (!node->global.inlined_to && DECL_SAVED_TREE (decl) - && !DECL_EXTERNAL (decl)) + && !DECL_EXTERNAL (decl) && !node->nested) { dump_cgraph_node (stderr, node); abort (); @@ -947,7 +947,10 @@ cgraph_remove_unreachable_nodes (void) if (cgraph_dump_file) fprintf (cgraph_dump_file, " %s", cgraph_node_name (node)); if (!node->analyzed || !DECL_EXTERNAL (node->decl)) - cgraph_remove_node (node); + { + if (!node->nested) + cgraph_remove_node (node); + } else { struct cgraph_edge *e; @@ -1029,10 +1032,14 @@ cgraph_clone_inlined_nodes (struct cgrap { struct cgraph_node *n; - /* We may eliminate the need for out-of-line copy to be output. In that - case just go ahead and re-use it. */ + /* We may eliminate the need for out-of-line copy to be output. In + that case just go ahead and re-use it. Make sure we don't re-use + it if it contains nested functions, otherwise when we remove the + node after inlining we'll remove the nested nodes as well, and + they might have to remain. */ if (!e->callee->callers->next_caller && (!e->callee->needed || DECL_EXTERNAL (e->callee->decl)) + && !e->callee->nested && duplicate && flag_unit_at_a_time) { @@ -1776,7 +1783,8 @@ cgraph_optimize (void) for (node = cgraph_nodes; node; node = node->next) if (node->analyzed && (node->global.inlined_to - || DECL_SAVED_TREE (node->decl))) + || DECL_SAVED_TREE (node->decl)) + && !node->nested) { error_found = true; dump_cgraph_node (stderr, node);