aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2003-07-03 19:57:45 +0200
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-07-03 17:57:45 +0000
commitee41cff421132bb2891a4ad51fae0f83ffcfe087 (patch)
tree27b2ad1b2e7356c9b0737fc034a897fd085149f1 /gcc/testsuite
parentfa5b060f90061ebf9d1f112d6a46f7759c1a0f66 (diff)
downloadgcc-ee41cff421132bb2891a4ad51fae0f83ffcfe087.zip
gcc-ee41cff421132bb2891a4ad51fae0f83ffcfe087.tar.gz
gcc-ee41cff421132bb2891a4ad51fae0f83ffcfe087.tar.bz2
* gcc.dg/i386-call-1.c: New test.
From-SVN: r68892
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/i386-call-1.c39
2 files changed, 43 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index c158b78..fe736d8 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..9cd49da
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-call-1.c
@@ -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;
+}