summaryrefslogtreecommitdiff
path: root/gcc/function.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-08-16 18:40:57 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-08-16 18:40:57 +0000
commitb38f3813f7ba380b33607e114a7efa9901191924 (patch)
tree4ab818c332a67c5a5e24c9d78cedd1099ebc04e2 /gcc/function.c
parent6c397102b275823c0d8ffb02ab7d74bb38ede5a9 (diff)
downloadgcc-b38f3813f7ba380b33607e114a7efa9901191924.tar.gz
re PR middle-end/20548 (ACATS c52103x c52104x c52104y segfault)
PR ada/20548 * common.opt (-fstack-check): Do not declare the variable here. (-fstack-check=): New option variant. * doc/invoke.texi (Code Gen Options): Document it. * expr.h (STACK_OLD_CHECK_PROTECT): New macro. (STACK_CHECK_PROTECT): Bump to 3 pages if DWARF-2 EH is used. (STACK_CHECK_STATIC_BUILTIN): New macro. * doc/tm.texi (Stack Checking): Document STACK_CHECK_STATIC_BUILTIN. * opts.c: Include expr.h. (common_handle_option) <OPT_fold_stack_check_>: New case. <OPT_fstack_check>: Likewise. * calls.c (initialize_argument_information): Use TYPE_SIZE_UNIT consistently in the test for variable-sized types. Adjust for new behaviour of flag_stack_check. * explow.c: Include except.h. (allocate_dynamic_stack_space): Do not take into account STACK_CHECK_MAX_FRAME_SIZE for static builtin stack checking. * function.c (gimplify_parameters): Use DECL_SIZE_UNIT in the test for variable-sized parameters. Treat all parameters whose size is greater than STACK_CHECK_MAX_VAR_SIZE as variable-sized if generic stack checking is enabled. * gimplify.c (gimplify_decl_expr): Treat non-static objects whose size is greater than STACK_CHECK_MAX_VAR_SIZE as variable-sized if generic stack checking is enabled. (expand_function_end): Adjust for new behaviour of flag_stack_check. * reload1.c (reload): Likewise. * stmt.c (expand_decl): Assert that all automatic variables have fixed size at this point and remove dead code. * flags.h (stack_check_type): New enumeration type. (flag_stack_check): Declare. * toplev.c (flag_stack_check): New global variable. * Makefile.in (opts.o): Add dependency on EXPR_H. (explow.o): Add dependency on except.h. ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): Use DECL_SIZE_UNIT in the setjmp test consistently. Adjust for new behaviour of flag_stack_check. * gcc-interface/utils2.c (build_call_alloc_dealloc): Remove redundant test of flag_stack_check. Adjust for new behaviour of flag_stack_check. From-SVN: r139159
Diffstat (limited to 'gcc/function.c')
-rw-r--r--gcc/function.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/gcc/function.c b/gcc/function.c
index 98b8da07365..da26dc7d114 100644
--- a/gcc/function.c
+++ b/gcc/function.c
@@ -3236,7 +3236,7 @@ gimplify_parameters (void)
walk_tree_without_duplicates (&data.passed_type,
gimplify_parm_type, &stmts);
- if (!TREE_CONSTANT (DECL_SIZE (parm)))
+ if (TREE_CODE (DECL_SIZE_UNIT (parm)) != INTEGER_CST)
{
gimplify_one_sizepos (&DECL_SIZE (parm), &stmts);
gimplify_one_sizepos (&DECL_SIZE_UNIT (parm), &stmts);
@@ -3250,9 +3250,12 @@ gimplify_parameters (void)
{
tree local, t;
- /* For constant sized objects, this is trivial; for
+ /* For constant-sized objects, this is trivial; for
variable-sized objects, we have to play games. */
- if (TREE_CONSTANT (DECL_SIZE (parm)))
+ if (TREE_CODE (DECL_SIZE_UNIT (parm)) == INTEGER_CST
+ && !(flag_stack_check == GENERIC_STACK_CHECK
+ && compare_tree_int (DECL_SIZE_UNIT (parm),
+ STACK_CHECK_MAX_VAR_SIZE) > 0))
{
local = create_tmp_var (type, get_name (parm));
DECL_IGNORED_P (local) = 0;
@@ -4480,10 +4483,10 @@ expand_function_end (void)
if (arg_pointer_save_area && ! crtl->arg_pointer_save_area_init)
get_arg_pointer_save_area ();
- /* If we are doing stack checking and this function makes calls,
+ /* If we are doing generic stack checking and this function makes calls,
do a stack probe at the start of the function to ensure we have enough
space for another stack frame. */
- if (flag_stack_check && ! STACK_CHECK_BUILTIN)
+ if (flag_stack_check == GENERIC_STACK_CHECK)
{
rtx insn, seq;
@@ -4491,7 +4494,7 @@ expand_function_end (void)
if (CALL_P (insn))
{
start_sequence ();
- probe_stack_range (STACK_CHECK_PROTECT,
+ probe_stack_range (STACK_OLD_CHECK_PROTECT,
GEN_INT (STACK_CHECK_MAX_FRAME_SIZE));
seq = get_insns ();
end_sequence ();