diff options
-rw-r--r-- | gcc/calls.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.target/i386/pr66891.c | 16 |
2 files changed, 22 insertions, 0 deletions
diff --git a/gcc/calls.c b/gcc/calls.c index 1e1a4356984..0987dd0a911 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3115,6 +3115,10 @@ expand_call (tree exp, rtx target, int ignore) compute_argument_addresses (args, argblock, num_actuals); + /* Stack is properly aligned, pops can't safely be deferred during + the evaluation of the arguments. */ + NO_DEFER_POP; + /* Precompute all register parameters. It isn't safe to compute anything once we have started filling any specific hard regs. TLS symbols sometimes need a call to resolve. Precompute @@ -3122,6 +3126,8 @@ expand_call (tree exp, rtx target, int ignore) to avoid unaligned stack in the called function. */ precompute_register_parameters (num_actuals, args, ®_parm_seen); + OK_DEFER_POP; + /* Perform stack alignment before the first push (the last arg). */ if (argblock == 0 && adjusted_args_size.constant > reg_parm_stack_space diff --git a/gcc/testsuite/gcc.target/i386/pr66891.c b/gcc/testsuite/gcc.target/i386/pr66891.c new file mode 100644 index 00000000000..61a45703196 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr66891.c @@ -0,0 +1,16 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-O2" } */ + +__attribute__((__stdcall__)) void fn1(); + +int a; + +static void fn2() { + for (;;) + ; +} + +void fn3() { + fn1(0); + fn2(a == 0); +} |