aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
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/ada/gcc-interface
parent6c397102b275823c0d8ffb02ab7d74bb38ede5a9 (diff)
downloadgcc-b38f3813f7ba380b33607e114a7efa9901191924.zip
gcc-b38f3813f7ba380b33607e114a7efa9901191924.tar.gz
gcc-b38f3813f7ba380b33607e114a7efa9901191924.tar.bz2
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/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/decl.c10
-rw-r--r--gcc/ada/gcc-interface/utils2.c7
2 files changed, 8 insertions, 9 deletions
diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c
index a136f96..65dd02e 100644
--- a/gcc/ada/gcc-interface/decl.c
+++ b/gcc/ada/gcc-interface/decl.c
@@ -1303,12 +1303,12 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
}
}
- if (definition && DECL_SIZE (gnu_decl)
+ if (definition && DECL_SIZE_UNIT (gnu_decl)
&& get_block_jmpbuf_decl ()
- && (TREE_CODE (DECL_SIZE (gnu_decl)) != INTEGER_CST
- || (flag_stack_check && !STACK_CHECK_BUILTIN
- && 0 < compare_tree_int (DECL_SIZE_UNIT (gnu_decl),
- STACK_CHECK_MAX_VAR_SIZE))))
+ && (TREE_CODE (DECL_SIZE_UNIT (gnu_decl)) != INTEGER_CST
+ || (flag_stack_check == GENERIC_STACK_CHECK
+ && compare_tree_int (DECL_SIZE_UNIT (gnu_decl),
+ STACK_CHECK_MAX_VAR_SIZE) > 0)))
add_stmt_with_node (build_call_1_expr
(update_setjmp_buf_decl,
build_unary_op (ADDR_EXPR, NULL_TREE,
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 0462426..5077e64 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -1920,11 +1920,11 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
/* ??? For now, disable variable-sized allocators in the stack since
we can't yet gimplify an ALLOCATE_EXPR. */
else if (gnat_pool == -1
- && TREE_CODE (gnu_size) == INTEGER_CST && !flag_stack_check)
+ && TREE_CODE (gnu_size) == INTEGER_CST
+ && flag_stack_check != GENERIC_STACK_CHECK)
{
/* If the size is a constant, we can put it in the fixed portion of
the stack frame to avoid the need to adjust the stack pointer. */
- if (TREE_CODE (gnu_size) == INTEGER_CST && !flag_stack_check)
{
tree gnu_range
= build_range_type (NULL_TREE, size_one_node, gnu_size);
@@ -1937,9 +1937,8 @@ build_call_alloc_dealloc (tree gnu_obj, tree gnu_size, unsigned align,
return convert (ptr_void_type_node,
build_unary_op (ADDR_EXPR, NULL_TREE, gnu_decl));
}
- else
- gcc_unreachable ();
#if 0
+ else
return build2 (ALLOCATE_EXPR, ptr_void_type_node, gnu_size, gnu_align);
#endif
}