aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-06-26 07:27:14 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2005-06-26 07:27:14 +0200
commitd9725c411caad2a174d3e3d91929240323661778 (patch)
tree8c9bcda4847f4df544cda5ec12d8094d3a8ec3f4
parent19dbbf3697cff8c0eb50b5ada203860c623f2cde (diff)
downloadgcc-d9725c411caad2a174d3e3d91929240323661778.zip
gcc-d9725c411caad2a174d3e3d91929240323661778.tar.gz
gcc-d9725c411caad2a174d3e3d91929240323661778.tar.bz2
re PR middle-end/17965 (ice in expand_call)
PR middle-end/17965 * calls.c (expand_call, emit_library_call_value_1): Use xmalloc/free instead of alloca for really big argument sizes. * gcc.c-torture/compile/20050622-1.c: New test. From-SVN: r101333
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/calls.c21
-rw-r--r--gcc/testsuite/ChangeLog3
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20050622-1.c16
4 files changed, 41 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 751cc70..f6ff44e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,9 @@
2005-06-26 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/17965
+ * calls.c (expand_call, emit_library_call_value_1): Use xmalloc/free
+ instead of alloca for really big argument sizes.
+
PR middle-end/22028
* gimplify.c (gimplify_type_sizes): Check for type == error_mark_node
earlier in the function.
diff --git a/gcc/calls.c b/gcc/calls.c
index b06830d..1613e88 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -1864,6 +1864,7 @@ expand_call (tree exp, rtx target, int ignore)
int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map;
+ char *stack_usage_map_buf = NULL;
int old_stack_allocated;
@@ -2350,7 +2351,10 @@ expand_call (tree exp, rtx target, int ignore)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map,
@@ -2455,7 +2459,10 @@ expand_call (tree exp, rtx target, int ignore)
= stack_arg_under_construction;
stack_arg_under_construction = 0;
/* Make a new map for the new argument list. */
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
memset (stack_usage_map, 0, highest_outgoing_arg_in_use);
highest_outgoing_arg_in_use = 0;
}
@@ -3009,6 +3016,9 @@ expand_call (tree exp, rtx target, int ignore)
emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx);
}
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+
return target;
}
@@ -3203,6 +3213,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
/* Size of the stack reserved for parameter registers. */
int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map;
+ char *stack_usage_map_buf = NULL;
rtx struct_value = targetm.calls.struct_value_rtx (0, 0);
@@ -3481,7 +3492,8 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed);
#endif
- stack_usage_map = alloca (highest_outgoing_arg_in_use);
+ stack_usage_map_buf = xmalloc (highest_outgoing_arg_in_use);
+ stack_usage_map = stack_usage_map_buf;
if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map,
@@ -3835,6 +3847,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
stack_usage_map = initial_stack_usage_map;
}
+ if (stack_usage_map_buf)
+ free (stack_usage_map_buf);
+
return value;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index a8ca329..e0a2ce5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,8 @@
2005-06-26 Jakub Jelinek <jakub@redhat.com>
+ PR middle-end/17965
+ * gcc.c-torture/compile/20050622-1.c: New test.
+
PR middle-end/22028
* gcc.dg/20050620-1.c: New test.
diff --git a/gcc/testsuite/gcc.c-torture/compile/20050622-1.c b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c
new file mode 100644
index 0000000..db18390
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20050622-1.c
@@ -0,0 +1,16 @@
+#if __SCHAR_MAX__ == 127 && __INT_MAX__ >= 2147483647
+struct S { char buf[72*1024*1024]; };
+#else
+struct S { char buf[64]; };
+#endif
+
+extern void bar (struct S);
+
+struct S s;
+
+int
+foo (void)
+{
+ bar (s);
+ return 0;
+}