Commit d9725c41 by Jakub Jelinek Committed by Jakub Jelinek

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
parent 19dbbf36
2005-06-26 Jakub Jelinek <jakub@redhat.com> 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 PR middle-end/22028
* gimplify.c (gimplify_type_sizes): Check for type == error_mark_node * gimplify.c (gimplify_type_sizes): Check for type == error_mark_node
earlier in the function. earlier in the function.
......
...@@ -1864,6 +1864,7 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -1864,6 +1864,7 @@ expand_call (tree exp, rtx target, int ignore)
int initial_highest_arg_in_use = highest_outgoing_arg_in_use; int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map; char *initial_stack_usage_map = stack_usage_map;
char *stack_usage_map_buf = NULL;
int old_stack_allocated; int old_stack_allocated;
...@@ -2350,7 +2351,10 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2350,7 +2351,10 @@ expand_call (tree exp, rtx target, int ignore)
highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use, highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed); needed);
#endif #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) if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map, memcpy (stack_usage_map, initial_stack_usage_map,
...@@ -2455,7 +2459,10 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -2455,7 +2459,10 @@ expand_call (tree exp, rtx target, int ignore)
= stack_arg_under_construction; = stack_arg_under_construction;
stack_arg_under_construction = 0; stack_arg_under_construction = 0;
/* Make a new map for the new argument list. */ /* 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); memset (stack_usage_map, 0, highest_outgoing_arg_in_use);
highest_outgoing_arg_in_use = 0; highest_outgoing_arg_in_use = 0;
} }
...@@ -3009,6 +3016,9 @@ expand_call (tree exp, rtx target, int ignore) ...@@ -3009,6 +3016,9 @@ expand_call (tree exp, rtx target, int ignore)
emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx); emit_move_insn (virtual_stack_dynamic_rtx, stack_pointer_rtx);
} }
if (stack_usage_map_buf)
free (stack_usage_map_buf);
return target; return target;
} }
...@@ -3203,6 +3213,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3203,6 +3213,7 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
/* Size of the stack reserved for parameter registers. */ /* Size of the stack reserved for parameter registers. */
int initial_highest_arg_in_use = highest_outgoing_arg_in_use; int initial_highest_arg_in_use = highest_outgoing_arg_in_use;
char *initial_stack_usage_map = stack_usage_map; char *initial_stack_usage_map = stack_usage_map;
char *stack_usage_map_buf = NULL;
rtx struct_value = targetm.calls.struct_value_rtx (0, 0); 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, ...@@ -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, highest_outgoing_arg_in_use = MAX (initial_highest_arg_in_use,
needed); needed);
#endif #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) if (initial_highest_arg_in_use)
memcpy (stack_usage_map, initial_stack_usage_map, memcpy (stack_usage_map, initial_stack_usage_map,
...@@ -3835,6 +3847,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value, ...@@ -3835,6 +3847,9 @@ emit_library_call_value_1 (int retval, rtx orgfun, rtx value,
stack_usage_map = initial_stack_usage_map; stack_usage_map = initial_stack_usage_map;
} }
if (stack_usage_map_buf)
free (stack_usage_map_buf);
return value; return value;
} }
......
2005-06-26 Jakub Jelinek <jakub@redhat.com> 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 PR middle-end/22028
* gcc.dg/20050620-1.c: New test. * gcc.dg/20050620-1.c: New test.
......
#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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment