From: uros Date: Fri, 17 Jul 2015 06:32:58 +0000 (+0000) Subject: PR rtl-optimization/66891 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d298c9333c94da50b00fd6ee84fcc8bc822b8fe;p=thirdparty%2Fgcc.git PR rtl-optimization/66891 * calls.c (expand_call): Wrap precompute_register_parameters with NO_DEFER_POP/OK_DEFER_POP to prevent deferred pops. testsuite/ChangeLog: PR target/66891 * gcc.target/i386/pr66891.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@225918 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9506686c49a9..bac556e75379 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-07-17 Uros Bizjak + + PR rtl-optimization/66891 + * calls.c (expand_call): Wrap precompute_register_parameters with + NO_DEFER_POP/OK_DEFER_POP to prevent deferred pops. + 2015-07-16 Nathan Sidwell * config/nvptx/mkoffload.c (process): Constify mapping variables. diff --git a/gcc/calls.c b/gcc/calls.c index 2a297b0dc95a..563672512bee 100644 --- a/gcc/calls.c +++ b/gcc/calls.c @@ -3144,6 +3144,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 @@ -3151,6 +3155,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/ChangeLog b/gcc/testsuite/ChangeLog index cf08693b9ada..d3a47c884d70 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-07-17 Uros Bizjak + + PR target/66891 + * gcc.target/i386/pr66891.c: New test. + 2015-07-16 Kyrylo Tkachov * gcc.target/arm/no-volatile-in-it.c: Skip if -mcpu is overriden. diff --git a/gcc/testsuite/gcc.target/i386/pr66891.c b/gcc/testsuite/gcc.target/i386/pr66891.c new file mode 100644 index 000000000000..61a45703196d --- /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); +}