re PR rtl-optimization/11304 (Wrong code production with -fomit-frame-pointer)
authorJakub Jelinek <jakub@redhat.com>
Tue, 5 Feb 2019 22:00:29 +0000 (23:00 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 5 Feb 2019 22:00:29 +0000 (23:00 +0100)
PR rtl-optimization/11304
* gcc.target/i386/call-1.c (set_eax): Add "eax" clobber.
* gcc.target/i386/call-2.c: New test.

From-SVN: r268562

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

index 71ea366199582d6cf47aada09582509e61cd7cca..4ae0914eb717c500b913b0abc22fb088473ce396 100644 (file)
@@ -1,3 +1,9 @@
+2019-02-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/11304
+       * gcc.target/i386/call-1.c (set_eax): Add "eax" clobber.
+       * gcc.target/i386/call-2.c: New test.
+
 2019-02-05  Marek Polacek  <polacek@redhat.com>
 
        PR c++/89158 - by-value capture of constexpr variable broken.
index bd7c569c69db95fe0e441a9e448e19de58d47b8e..a2693a315c1ac3f2d80de3faa2c9c0a7042edb3f 100644 (file)
@@ -11,7 +11,7 @@ volatile int r;
 
 void set_eax(int val)
 {
-  __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val));
+  __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val) : "eax");
 }
 
 void foo(int val)
diff --git a/gcc/testsuite/gcc.target/i386/call-2.c b/gcc/testsuite/gcc.target/i386/call-2.c
new file mode 100644 (file)
index 0000000..0dffcac
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR optimization/11304 */
+/* Originator: <manuel.serrano@sophia.inria.fr> */
+/* { dg-do run } */
+/* { dg-options "-O -fomit-frame-pointer" } */
+
+/* Verify that %eax is always restored after a call.  */
+
+__attribute__((noipa)) void set_eax(int val);
+__attribute__((noipa)) void foo(int val);
+__attribute__((noipa)) int bar(int x);
+
+#include "call-1.c"