OSDN Git Service

* gcc.dg/i386-call-1.c: New test.
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jul 2003 17:57:45 +0000 (17:57 +0000)
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 3 Jul 2003 17:57:45 +0000 (17:57 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68892 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/i386-call-1.c [new file with mode: 0644]

index c158b78..fe736d8 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-03  Eric Botcazou  <ebotcazou@libertysurf.fr>
+
+       * gcc.dg/i386-call-1.c: New test.
+
 2003-07-03  Nathan Sidwell  <nathan@codesourcery.com>
 
        PR c++/9162
diff --git a/gcc/testsuite/gcc.dg/i386-call-1.c b/gcc/testsuite/gcc.dg/i386-call-1.c
new file mode 100644 (file)
index 0000000..9cd49da
--- /dev/null
@@ -0,0 +1,39 @@
+/* PR optimization/11304 */
+/* Originator: <manuel.serrano@sophia.inria.fr> */
+/* { dg-do run { target i?86-*-* } } */
+/* { dg-options "-O -fomit-frame-pointer" } */
+
+/* Verify that %eax is always restored after a call.  */
+
+extern void abort(void);
+
+volatile int r;
+
+void set_eax(int val)
+{
+  __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val));
+}
+
+void foo(int val)
+{
+  r = val;
+}
+
+int bar(int x)
+{
+  if (x)
+  {
+    set_eax(0);
+    return x;
+  }
+
+  foo(x);
+}
+
+int main(void)
+{
+  if (bar(1) != 1)
+    abort();
+
+  return 0;
+}