summaryrefslogtreecommitdiffstats
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authoramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-11 09:51:17 +0000
committeramodra <amodra@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-11 09:51:17 +0000
commitc5dc0c3255e78312be3499e11a214e1c40f1c58d (patch)
tree8327d7ab80bc3b691512853606494ea8aaaa0ae4 /gcc/builtins.c
parentfd2a554e64b851b5a2759fc20d1296e34d6039e1 (diff)
downloadppe42-gcc-c5dc0c3255e78312be3499e11a214e1c40f1c58d.tar.gz
ppe42-gcc-c5dc0c3255e78312be3499e11a214e1c40f1c58d.zip
PR target/18916
* builtins.c (std_gimplify_va_arg_expr): Adjust alignment of *ap. * expr.h (struct locate_and_pad_arg_data): Add "boundary". * function.c (locate_and_pad_parm): Set new field. (assign_parm_find_stack_rtl): Use it instead of FUNCTION_ARG_BOUNDARY. Tweak where_pad test to include "none". Always set mem align for stack_parm. (assign_parm_adjust_stack_rtl): Discard stack_parm if alignment not sufficient for type. (assign_parm_setup_block): If stack_parm is zero on entry, always make a new stack local. Block move old stack parm if necessary to new aligned stack local. (assign_parm_setup_stack): Use a block move to handle potentially misaligned entry_parm. (assign_parms_unsplit_complex): Specify required alignment when creating stack local. * calls.c (compute_argument_addresses): Override alignment of stack arg calculated from its type with the alignment given by FUNCTION_ARG_BOUNDARY. (store_one_arg): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93179 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index b41212ae2e0..e231d8361cc 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -1,6 +1,6 @@
/* Expand builtin functions.
Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
- 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+ 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
This file is part of GCC.
@@ -3894,6 +3894,18 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
build2 (BIT_AND_EXPR, TREE_TYPE (valist), valist_tmp, t));
gimplify_and_add (t, pre_p);
}
+ else
+ boundary = align;
+
+ /* If the actual alignment is less than the alignment of the type,
+ adjust the type accordingly so that we don't assume strict alignment
+ when deferencing the pointer. */
+ boundary *= BITS_PER_UNIT;
+ if (boundary < TYPE_ALIGN (type))
+ {
+ type = build_variant_type_copy (type);
+ TYPE_ALIGN (type) = boundary;
+ }
/* Compute the rounded size of the type. */
type_size = size_in_bytes (type);
OpenPOWER on IntegriCloud