[Bug tree-optimization/36218] [4.2/4.3/4.4 regression] VRP causes stack overflow while building libgcj
aph at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Jul 30 09:24:00 GMT 2008
------- Comment #14 from aph at gcc dot gnu dot org 2008-07-30 09:23 -------
This patch limits recursion in tree-vrp.
Index: tree-vrp.c
===================================================================
--- tree-vrp.c (revision 136670)
+++ tree-vrp.c (working copy)
@@ -4049,6 +4049,8 @@
the predicate operands, an assert location node is added to the
list of assertions for the corresponding operands. */
+static size_t depth;
+
static bool
find_conditional_asserts (basic_block bb, tree last)
{
@@ -4062,6 +4064,10 @@
need_assert = false;
bsi = bsi_for_stmt (last);
+ depth++;
+ if (depth > 500)
+ goto ret;
+
/* Look for uses of the operands in each of the sub-graphs
rooted at BB. We need to check each of the outgoing edges
separately, so that we know what kind of ASSERT_EXPR to
@@ -4121,6 +4127,8 @@
FOR_EACH_SSA_TREE_OPERAND (op, last, iter, SSA_OP_USE)
SET_BIT (found_in_subgraph, SSA_NAME_VERSION (op));
+ ret:
+ depth--;
return need_assert;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36218
More information about the Gcc-bugs
mailing list