From 60bf20045f4a747573b2759e8228173edb0e6f12 Mon Sep 17 00:00:00 2001 From: Brendan Kehoe Date: Mon, 28 Jul 1997 19:08:39 -0400 Subject: integrate.c (expand_inline_function): Use xmalloc instead of alloca for the LABEL_MAP. * integrate.c (expand_inline_function): Use xmalloc instead of alloca for the LABEL_MAP. (save_for_inline_copying): Likewise. From-SVN: r14546 --- gcc/integrate.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/integrate.c b/gcc/integrate.c index 467bfb6..217d24b 100644 --- a/gcc/integrate.c +++ b/gcc/integrate.c @@ -414,6 +414,10 @@ save_for_inline_copying (fndecl) rtx first_nonparm_insn; char *new, *new1; + /* The pointer used to track the true location of the memory used + for LABEL_MAP. */ + rtx *real_label_map = NULL_PTR; + /* Make and emit a return-label if we have not already done so. Do this before recording the bounds on label numbers. */ @@ -512,8 +516,12 @@ save_for_inline_copying (fndecl) /* Likewise each label rtx must have a unique rtx as its copy. */ - label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx)); - label_map -= min_labelno; + /* We used to use alloca here, but the size of what it would try to + allocate would occasionally cause it to exceed the stack limit and + cause unpredictable core dumps. Some examples were > 2Mb in size. */ + real_label_map + = (rtx *) xmalloc ((max_labelno - min_labelno) * sizeof (rtx)); + label_map = real_label_map - min_labelno; for (i = min_labelno; i < max_labelno; i++) label_map[i] = gen_label_rtx (); @@ -655,6 +663,9 @@ save_for_inline_copying (fndecl) regno_pointer_align = new1; set_new_first_and_last_insn (first_insn, last_insn); + + if (real_label_map) + free (real_label_map); } /* Return a copy of a chain of nodes, chained through the TREE_CHAIN field. -- cgit v1.1