This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] gc stack overflow
- From: Richard Henderson <rth at twiddle dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 14 Oct 2003 20:12:25 -0700
- Subject: [tree-ssa] gc stack overflow
Got a stack overflow in the gc mark routines from the ggc_alloc
that's in PRE. Biggest problem is that we recurse for all those
COMPOUND_EXPRs instead of iterating.
This almost certainly shouldn't be C specific. However, I'm in
the middle of something else and this was the smallest change
to lead to working bootstrap.
r~
* c-tree.h (C_LANG_TREE_NODE_CHAIN_NEXT): New.
(union lang_tree_node): Use it for chain_next annotation.
Index: c-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-tree.h,v
retrieving revision 1.99.2.23
diff -u -p -r1.99.2.23 c-tree.h
--- c-tree.h 6 Oct 2003 17:36:13 -0000 1.99.2.23
+++ c-tree.h 15 Oct 2003 03:06:07 -0000
@@ -46,13 +46,20 @@ struct lang_identifier GTY(())
union lang_tree_node
GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"),
- chain_next ("TREE_CODE (&%h.generic) == INTEGER_TYPE ? (union lang_tree_node *)TYPE_NEXT_VARIANT (&%h.generic) : (union lang_tree_node *)TREE_CHAIN (&%h.generic)")))
+ chain_next ("C_LANG_TREE_NODE_CHAIN_NEXT (&%h.generic)")))
{
union tree_node GTY ((tag ("0"),
desc ("tree_node_structure (&%h)")))
generic;
struct lang_identifier GTY ((tag ("1"))) identifier;
};
+
+/* For gc purposes, return the most likely link for the longest chain. */
+#define C_LANG_TREE_NODE_CHAIN_NEXT(T) \
+ ((union lang_tree_node *) \
+ (TREE_CODE (T) == INTEGER_TYPE ? TYPE_NEXT_VARIANT (T) \
+ : TREE_CODE (T) == COMPOUND_EXPR ? TREE_OPERAND (T, 1) \
+ : TREE_CHAIN (T)))
/* Language-specific declaration information. */