aboutsummaryrefslogtreecommitdiff
path: root/gcc/integrate.c
diff options
context:
space:
mode:
authorBrendan Kehoe <brendan@gcc.gnu.org>1997-07-28 15:49:08 -0400
committerBrendan Kehoe <brendan@gcc.gnu.org>1997-07-28 15:49:08 -0400
commit3bb1329eda5f5c4997aad7b8b4014890e9c6b433 (patch)
tree9adc8541ca9e0f9c1137931a1a64098af019fea3 /gcc/integrate.c
parent2f8844a8b6bc71fb4d7e67cdd60517336fb9682f (diff)
downloadgcc-3bb1329eda5f5c4997aad7b8b4014890e9c6b433.zip
gcc-3bb1329eda5f5c4997aad7b8b4014890e9c6b433.tar.gz
gcc-3bb1329eda5f5c4997aad7b8b4014890e9c6b433.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. From-SVN: r14545
Diffstat (limited to 'gcc/integrate.c')
-rw-r--r--gcc/integrate.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 92052bf..467bfb6 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -1239,6 +1239,10 @@ expand_inline_function (fndecl, parms, target, ignore, type,
rtvec arg_vector = ORIGINAL_ARG_VECTOR (header);
rtx static_chain_value = 0;
+ /* The pointer used to track the true location of the memory used
+ for MAP->LABEL_MAP. */
+ rtx *real_label_map = NULL_PTR;
+
/* Allow for equivalences of the pseudos we make for virtual fp and ap. */
max_regno = MAX_REGNUM (header) + 3;
if (max_regno < FIRST_PSEUDO_REGISTER)
@@ -1379,8 +1383,12 @@ expand_inline_function (fndecl, parms, target, ignore, type,
map->reg_map = (rtx *) alloca (max_regno * sizeof (rtx));
bzero ((char *) map->reg_map, max_regno * sizeof (rtx));
- map->label_map = (rtx *)alloca ((max_labelno - min_labelno) * sizeof (rtx));
- map->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. */
+ real_label_map
+ = (rtx *) xmalloc ((max_labelno - min_labelno) * sizeof (rtx));
+ map->label_map = real_label_map - min_labelno;
map->insn_map = (rtx *) alloca (INSN_UID (header) * sizeof (rtx));
bzero ((char *) map->insn_map, INSN_UID (header) * sizeof (rtx));
@@ -2019,6 +2027,11 @@ expand_inline_function (fndecl, parms, target, ignore, type,
memory_address (TYPE_MODE (type), structure_value_addr));
MEM_IN_STRUCT_P (target) = 1;
}
+
+ /* Make sure we free the things we explicitly allocated with xmalloc. */
+ if (real_label_map)
+ free (real_label_map);
+
return target;
}