OSDN Git Service

* calls.c (expand_call): Emit queued insns before creating
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Nov 2000 20:15:13 +0000 (20:15 +0000)
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 30 Nov 2000 20:15:13 +0000 (20:15 +0000)
        the tail recursion sequence.

* gcc.c-torture/execute/20001130-1.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37898 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/calls.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/execute/20001130-1.c [new file with mode: 0644]

index 65855dd..3b38448 100644 (file)
@@ -1,3 +1,8 @@
+2000-11-30  Richard Henderson  <rth@redhat.com>
+
+       * calls.c (expand_call): Emit queued insns before creating
+       the tail recursion sequence.
+
 2000-11-30  J. David Anglin  <dave.anglin@nrc.ca>
             Bruce Korb  <bkorb@gnu.org>
 
index 45210c2..9513c30 100644 (file)
@@ -2552,6 +2552,10 @@ expand_call (exp, target, ignore)
       int save_pending_stack_adjust = pending_stack_adjust;
       int save_stack_pointer_delta = stack_pointer_delta;
 
+      /* Emit any queued insns now; otherwise they would end up in
+        only one of the alternates.  */
+      emit_queue ();
+
       /* Use a new sequence to hold any RTL we generate.  We do not even
         know if we will use this RTL yet.  The final decision can not be
         made until after RTL generation for the entire function is
index ca0fc26..f9c90e2 100644 (file)
@@ -1,3 +1,7 @@
+2000-11-30  Richard Henderson  <rth@redhat.com>
+
+       * gcc.c-torture/execute/20001130-1.c: New test.
+
 2000-11-30  Nathan Sidwell  <nathan@codesourcery.com>
 
        * g++.old-deja/g++.other/op3.C: New test.
diff --git a/gcc/testsuite/gcc.c-torture/execute/20001130-1.c b/gcc/testsuite/gcc.c-torture/execute/20001130-1.c
new file mode 100644 (file)
index 0000000..4a996ee
--- /dev/null
@@ -0,0 +1,21 @@
+static inline int bar(void) { return 1; }
+static int mem[3];
+
+static int foo(int x)
+{
+  if (x != 0)
+    return x;
+
+  mem[x++] = foo(bar());
+
+  if (x != 1)
+    abort();
+
+  return 0;
+}
+
+int main()
+{
+  foo(0);
+  return 0;
+}