aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@gcc.gnu.org>1997-07-28 19:08:39 -0400
committerBrendan Kehoe <brendan@gcc.gnu.org>1997-07-28 19:08:39 -0400
commit60bf20045f4a747573b2759e8228173edb0e6f12 (patch)
treefbd750fc0ec8485e8d92ea25b410438bb9050324 /gcc
parent3bb1329eda5f5c4997aad7b8b4014890e9c6b433 (diff)
downloadgcc-60bf20045f4a747573b2759e8228173edb0e6f12.zip
gcc-60bf20045f4a747573b2759e8228173edb0e6f12.tar.gz
gcc-60bf20045f4a747573b2759e8228173edb0e6f12.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/integrate.c15
1 files changed, 13 insertions, 2 deletions
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.