summaryrefslogtreecommitdiff
path: root/gcc/c-gimplify.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-24 05:35:16 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2004-06-24 05:35:16 +0000
commit5063000d1dd5d05e86e6b44c621e953f88df5193 (patch)
tree50d2015aa08fd0447f47471177e699b5db3fab80 /gcc/c-gimplify.c
parentc98c59df8190bc3f8fcdb5755d81b0dcd7e2ed4e (diff)
downloadgcc-5063000d1dd5d05e86e6b44c621e953f88df5193.tar.gz
* c-gimplify.c (gimplify_decl_stmt): Push gimplify_one_sizepos inside
non-constant size check. Gimplify the type too. Tidy building BUILT_IN_STACK_ALLOC call git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83582 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-gimplify.c')
-rw-r--r--gcc/c-gimplify.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/gcc/c-gimplify.c b/gcc/c-gimplify.c
index a3040d0bcd2..44af046d1ee 100644
--- a/gcc/c-gimplify.c
+++ b/gcc/c-gimplify.c
@@ -488,25 +488,25 @@ gimplify_decl_stmt (tree *stmt_p)
{
tree init = DECL_INITIAL (decl);
- gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
- gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
-
if (!TREE_CONSTANT (DECL_SIZE (decl)))
{
/* This is a variable-sized decl. Simplify its size and mark it
for deferred expansion. Note that mudflap depends on the format
of the emitted code: see mx_register_decls(). */
- tree pt_type = build_pointer_type (TREE_TYPE (decl));
- tree alloc_stmt
- = (build_function_call_expr
- (implicit_built_in_decls[BUILT_IN_STACK_ALLOC],
- tree_cons (NULL_TREE,
- build1 (ADDR_EXPR, pt_type, decl),
- tree_cons (NULL_TREE, DECL_SIZE_UNIT (decl),
- NULL_TREE))));
+ tree t, args;
+
+ gimplify_type_sizes (TREE_TYPE (decl), stmt_p);
+ gimplify_one_sizepos (&DECL_SIZE (decl), stmt_p);
+ gimplify_one_sizepos (&DECL_SIZE_UNIT (decl), stmt_p);
+
+ args = tree_cons (NULL, DECL_SIZE_UNIT (decl), NULL);
+ t = build_fold_addr_expr (decl);
+ args = tree_cons (NULL, t, args);
+ t = implicit_built_in_decls[BUILT_IN_STACK_ALLOC];
+ t = build_function_call_expr (t, args);
- gimplify_and_add (alloc_stmt, stmt_p);
+ gimplify_and_add (t, stmt_p);
DECL_DEFER_OUTPUT (decl) = 1;
}