summaryrefslogtreecommitdiff
path: root/gcc/stmt.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-16 18:40:57 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-08-16 18:40:57 +0000
commit4852b82934092d13e2b3e1a183a789e5e97f6729 (patch)
tree4ab818c332a67c5a5e24c9d78cedd1099ebc04e2 /gcc/stmt.c
parent5ca16c548b7739e67ec4adc9a5ce233613eeb9d4 (diff)
downloadgcc-4852b82934092d13e2b3e1a183a789e5e97f6729.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@139159 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stmt.c')
-rw-r--r--gcc/stmt.c46
1 files changed, 5 insertions, 41 deletions
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 38d7b439aec..f05cd0956fc 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -1867,8 +1867,8 @@ expand_decl (tree decl)
SET_DECL_RTL (decl, gen_rtx_MEM (BLKmode, const0_rtx));
else if (DECL_SIZE (decl) == 0)
- /* Variable with incomplete type. */
{
+ /* Variable with incomplete type. */
rtx x;
if (DECL_INITIAL (decl) == 0)
/* Error message was already done; now avoid a crash. */
@@ -1899,16 +1899,15 @@ expand_decl (tree decl)
TYPE_ALIGN (TREE_TYPE (TREE_TYPE (decl))));
}
- else if (TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST
- && ! (flag_stack_check && ! STACK_CHECK_BUILTIN
- && 0 < compare_tree_int (DECL_SIZE_UNIT (decl),
- STACK_CHECK_MAX_VAR_SIZE)))
+ else
{
- /* Variable of fixed size that goes on the stack. */
rtx oldaddr = 0;
rtx addr;
rtx x;
+ /* Variable-sized decls are dealt with in the gimplifier. */
+ gcc_assert (TREE_CODE (DECL_SIZE_UNIT (decl)) == INTEGER_CST);
+
/* If we previously made RTL for this decl, it must be an array
whose size was determined by the initializer.
The old address was a register; set that register now
@@ -1936,41 +1935,6 @@ expand_decl (tree decl)
emit_move_insn (oldaddr, addr);
}
}
- else
- /* Dynamic-size object: must push space on the stack. */
- {
- rtx address, size, x;
-
- /* Record the stack pointer on entry to block, if have
- not already done so. */
- do_pending_stack_adjust ();
-
- /* Compute the variable's size, in bytes. This will expand any
- needed SAVE_EXPRs for the first time. */
- size = expand_normal (DECL_SIZE_UNIT (decl));
- free_temp_slots ();
-
- /* Allocate space on the stack for the variable. Note that
- DECL_ALIGN says how the variable is to be aligned and we
- cannot use it to conclude anything about the alignment of
- the size. */
- address = allocate_dynamic_stack_space (size, NULL_RTX,
- TYPE_ALIGN (TREE_TYPE (decl)));
-
- /* Reference the variable indirect through that rtx. */
- x = gen_rtx_MEM (DECL_MODE (decl), address);
- set_mem_attributes (x, decl, 1);
- SET_DECL_RTL (decl, x);
-
-
- /* Indicate the alignment we actually gave this variable. */
-#ifdef STACK_BOUNDARY
- DECL_ALIGN (decl) = STACK_BOUNDARY;
-#else
- DECL_ALIGN (decl) = BIGGEST_ALIGNMENT;
-#endif
- DECL_USER_ALIGN (decl) = 0;
- }
}
/* Emit code to save the current value of stack. */