re PR rtl-optimization/66891 (ICE in expand_call, at calls.c:3407)
authorUros Bizjak <ubizjak@gmail.com>
Fri, 17 Jul 2015 06:32:58 +0000 (08:32 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Fri, 17 Jul 2015 06:32:58 +0000 (08:32 +0200)
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.

From-SVN: r225918

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr66891.c [new file with mode: 0644]

index 9506686c49a9f2793c61064a5edfbc66bcc099ef..bac556e75379c3461161f69f7fb63e2b34212698 100644 (file)
@@ -1,3 +1,9 @@
+2015-07-17  Uros Bizjak  <ubizjak@gmail.com>
+
+       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  <nathan@codesourcery.com>
 
        * config/nvptx/mkoffload.c (process): Constify mapping variables.
index 2a297b0dc95aee01f02a2211ed0e4bfbfdd6e89d..563672512beea3b448d8d552c0208036dc06f8bd 100644 (file)
@@ -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, &reg_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
index cf08693b9ada311a871e1f7d166b0440db2b27a2..d3a47c884d7061a340b3bce696c2cef10c84ffc2 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-17  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/66891
+       * gcc.target/i386/pr66891.c: New test.
+
 2015-07-16  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * 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 (file)
index 0000000..61a4570
--- /dev/null
@@ -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);
+}