aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2008-07-18 15:48:04 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2008-07-18 08:48:04 -0700
commitc565a1e7b774b3a578f15ca865e5eb69aebc0820 (patch)
treec2c577487a8faefadd1df0441597ce049b27a9d8 /gcc/builtins.c
parent5ae53a2559819d1628193d5a3d9257029ebe1fe7 (diff)
downloadgcc-c565a1e7b774b3a578f15ca865e5eb69aebc0820.zip
gcc-c565a1e7b774b3a578f15ca865e5eb69aebc0820.tar.gz
gcc-c565a1e7b774b3a578f15ca865e5eb69aebc0820.tar.bz2
re PR middle-end/36859 (Caller/callee mismatch for vararg on stack)
gcc/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36859 * builtins.c (std_gimplify_va_arg_expr): Limit alignment to PREFERRED_STACK_BOUNDARY. * config/i386/i386.c (ix86_gimplify_va_arg): Likewise. testsuite/ 2008-07-18 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/36859 * gcc.target/i386/vararg-2.c: New. From-SVN: r137955
Diffstat (limited to 'gcc/builtins.c')
-rw-r--r--gcc/builtins.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/builtins.c b/gcc/builtins.c
index 60caa81..89eca00 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -4775,7 +4775,16 @@ std_gimplify_va_arg_expr (tree valist, tree type, tree *pre_p, tree *post_p)
type = build_pointer_type (type);
align = PARM_BOUNDARY / BITS_PER_UNIT;
- boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type) / BITS_PER_UNIT;
+ boundary = FUNCTION_ARG_BOUNDARY (TYPE_MODE (type), type);
+
+ /* When we align parameter on stack for caller, if the parameter
+ alignment is beyond PREFERRED_STACK_BOUNDARY, it will be
+ aligned at PREFERRED_STACK_BOUNDARY. We will match callee
+ here with caller. */
+ if (boundary > PREFERRED_STACK_BOUNDARY)
+ boundary = PREFERRED_STACK_BOUNDARY;
+
+ boundary /= BITS_PER_UNIT;
/* Hoist the valist value into a temporary for the moment. */
valist_tmp = get_initialized_tmp_var (valist, pre_p, NULL);