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
This commit is contained in:
parent
19dbbf3697
commit
d9725c411c
4 changed files with 41 additions and 3 deletions
|
@ -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.
|
||||
|
|
21
gcc/calls.c
21
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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
16
gcc/testsuite/gcc.c-torture/compile/20050622-1.c
Normal file
16
gcc/testsuite/gcc.c-torture/compile/20050622-1.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Add table
Reference in a new issue