aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorH.J. Lu <hongjiu.lu@intel.com>2010-09-17 18:00:40 +0000
committerH.J. Lu <hjl@gcc.gnu.org>2010-09-17 11:00:40 -0700
commit2b3ded42e21a97f7d4a04f13280cc3eeb98f60ca (patch)
tree889306a9ce992c2efd49c6bf57d4cea16247242e /gcc/calls.c
parentbf9afb7d953d7f77c6305fed27c5fcd1a485686b (diff)
downloadgcc-2b3ded42e21a97f7d4a04f13280cc3eeb98f60ca.zip
gcc-2b3ded42e21a97f7d4a04f13280cc3eeb98f60ca.tar.gz
gcc-2b3ded42e21a97f7d4a04f13280cc3eeb98f60ca.tar.bz2
Make sure that all variable sized adjustments are multiple of preferred
stack boundary after stack alignment. gcc/ 2010-09-17 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/45234 * calls.c (expand_call): Make sure that all variable sized adjustments are multiple of preferred stack boundary after stack alignment. gcc/testsuite/ 2010-09-17 H.J. Lu <hongjiu.lu@intel.com> PR middle-end/45234 * gcc.dg/torture/stackalign/alloca-5.c: New. From-SVN: r164377
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 3888831..b3109cee 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -2385,6 +2385,19 @@ expand_call (tree exp, rtx target, int ignore)
preferred_unit_stack_boundary = preferred_stack_boundary / BITS_PER_UNIT;
+ if (SUPPORTS_STACK_ALIGNMENT)
+ {
+ /* All variable sized adjustments must be multiple of preferred
+ stack boundary. Stack alignment may change preferred stack
+ boundary after variable sized adjustments have been made. We
+ need to compensate it here. */
+ unsigned HOST_WIDE_INT delta
+ = ((stack_pointer_delta - pending_stack_adjust)
+ % preferred_unit_stack_boundary);
+ if (delta)
+ anti_adjust_stack (GEN_INT (preferred_unit_stack_boundary - delta));
+ }
+
/* We want to make two insn chains; one for a sibling call, the other
for a normal call. We will select one of the two chains after
initial RTL generation is complete. */