GCC build failed for native with your patch on 2003-08-29T23:41:55Z.

Geoff Keating geoffk@geoffk.org
Tue Sep 2 21:10:00 GMT 2003


"GCC regression checker" <geoffk@apple.com> writes:

> With your recent patch, GCC does not compile on:
>  native
> Attached is build output for those targets.
> 
> The build failures are new.

> /Users/regress/tbox/native/build/powerpc-apple-darwin6.3/libstdc++-v3/include/bits/locale_facets.h:1670: internal compiler error: tree check: expected tree_list, have switch_stmt in build_over_call, at cp/call.c:4571

This appears to be caused by calling ggc_collect inside
optimize_inline_calls.  optimize_inline_calls keeps a varray which is
only referenced by a local variable, 'id'; thus, you must not call
ggc_collect inside it or the varray will be freed causing havoc later on.

I am not sure which patch, if any, in this set is responsible, but I
suspect it's due to:

2003-08-29  Richard Henderson  <rth@redhat.com>

	* tree-optimize.c: New file.
	* Makefile.in (OBJS-archive): Add tree-optimize.o.
	(tree-optimize.o): New.
	* c-decl.c (store_parm_decls): Use allocate_struct_function.
	(finish_function): Don't free_after_parsing or free_after_compilation.
	(set_save_expr_context): Move to tree-optimize.c.
	(c_expand_body_1): Use tree_rest_of_compilation.
	* c-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New.
	* objc/objc-lang.c (LANG_HOOKS_RTL_EXPAND_STMT): New.
	* c-objc-common.c (expand_deferred_fns): Don't emit unused inlines;
	iterate until closure.
	* langhooks-def.h (LANG_HOOKS_RTL_EXPAND_START,
	LANG_HOOKS_RTL_EXPAND_STMT, LANG_HOOKS_RTL_EXPAND_END): New.
	(LANG_HOOKS_RTL_EXPAND_INITIALIZER): New.
	* langhooks.h (struct lang_hooks_for_rtl_expansion): New.
	* toplev.h (tree_rest_of_compilation): Declare it.

This problem should have been easy to reproduce with an
--enable-checking=tree,misc,gc,gcac build on any platform.

What I think I'll do to fix this is to put struct inline_data into a
list that can be referenced by a GCed global.  The alternative is to
use ggc_push_context, but that's known to be bad for performance.

The actual backtrace is below, look at frames 0 and 15.

#0  ggc_collect () at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/ggc-page.c:1742
#1  0x00191c9c in rest_of_compilation (decl=0x10cd000) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/toplev.c:3046
#2  0x002d565c in tree_rest_of_compilation (fndecl=0x5a5890) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-optimize.c:173
#3  0x0010d240 in expand_body (fn=0x5a5890) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/semantics.c:2892
#4  0x0011c0bc in maybe_clone_body (fn=0x5c54c0) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/optimize.c:253
#5  0x0010d3c4 in expand_or_defer_fn (fn=0x0) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/semantics.c:2945
#6  0x00077584 in instantiate_decl (d=0x10cbe00, defer_ok=15326496) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/pt.c:10952
#7  0x00116b24 in cp_cannot_inline_tree_fn (fnp=0xbfffef78) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/tree.c:2039
#8  0x00208f30 in inlinable_function_p (fn=0x10cce00) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:951
#9  0x00209288 in limits_allow_inlining (fn=0x10cce00, id=0x0) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1047
#10 0x00209844 in expand_call_inline (tp=0x10a8a94, walk_subtrees=0xbffff068, data=0xbffff270) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1228
#11 0x0020b6c8 in walk_tree (tp=0x4d74c4, func=0x10a8a94 <pch_address_space+10910356>, data=0xbffff270, htab_=0xa63490) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1642
#12 0x0020ba28 in walk_tree (tp=0x4d74c4, func=0x10a8a94 <pch_address_space+10910356>, data=0xbffff270, htab_=0xa63490) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1690
#13 0x0020ba28 in walk_tree (tp=0x4d74c4, func=0x10a8a94 <pch_address_space+10910356>, data=0xbffff270, htab_=0xa63490) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1690
#14 0x0020ba28 in walk_tree (tp=0x4d74c4, func=0x10a8a94 <pch_address_space+10910356>, data=0xbffff270, htab_=0xa63490) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1690
#15 0x0020b2c0 in optimize_inline_calls (fn=0x10cce00) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/tree-inline.c:1549
#16 0x0011b820 in optimize_function (fn=0x10cce00) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/optimize.c:59
#17 0x0010d230 in expand_body (fn=0x10cce00) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/semantics.c:2889
#18 0x00077584 in instantiate_decl (d=0x10c50e0, defer_ok=5076396) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/pt.c:10952
#19 0x00077e58 in instantiate_pending_templates () at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/pt.c:11028
#20 0x000a534c in finish_file () at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/cp/decl2.c:2675
#21 0x0018f480 in compile_file () at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/toplev.c:1731
#22 0x00194234 in do_compile () at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/toplev.c:4406
#23 0x00194370 in toplev_main (argc=43, argv=0xbffff6bc) at /Network/Servers/cauchy/homes/thorin/gkeating/co/egcs-mainline/gcc/gcc/toplev.c:4446
#24 0x000027a4 in _start (argc=43, argv=0xbffff6bc, envp=0xbffff76c) at /SourceCache/Csu/Csu-45/crt.c:267

-- 
- Geoffrey Keating <geoffk@geoffk.org>



More information about the Gcc-regression mailing list