GC Bug
Bernd Schmidt
bernds@cygnus.co.uk
Thu Sep 9 06:49:00 GMT 1999
On Thu, 9 Sep 1999, Richard Earnshaw wrote:
> I'm trying to track down a GC problem on the ARM, which causes a crash.
> I've found the following fragment in except.c:
>
> static rtx
> call_get_eh_context ()
> {
> static tree fn;
> tree expr;
>
> if (fn == NULL_TREE)
> {
>
>
> Note that fn is persistent, but there seems to be no gc root registered
> for this when it is first allocated. Hence, the tree can get GCed later
> and if subsequently recalled can contain garbage.
Try this patch.
Bernd
* except.c (call_get_eh_context): Add root when allocating static
tree variable.
Index: except.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/except.c,v
retrieving revision 1.96
diff -u -p -r1.96 except.c
--- except.c 1999/09/09 07:17:20 1.96
+++ except.c 1999/09/09 13:45:50
@@ -1101,6 +1101,8 @@ call_get_eh_context ()
make_decl_rtl (fn, NULL_PTR, 1);
assemble_external (fn);
pop_obstacks ();
+
+ ggc_add_tree_root (&fn, 1);
}
expr = build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (fn)), fn);
More information about the Gcc-bugs
mailing list