From: Jakub Jelinek Date: Tue, 5 Feb 2019 22:00:29 +0000 (+0100) Subject: re PR rtl-optimization/11304 (Wrong code production with -fomit-frame-pointer) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6fc4ecbc55bbf1995513102bba88a934b51a146b;p=gcc.git re PR rtl-optimization/11304 (Wrong code production with -fomit-frame-pointer) 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 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 71ea3661995..4ae0914eb71 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2019-02-05 Jakub Jelinek + + 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 PR c++/89158 - by-value capture of constexpr variable broken. diff --git a/gcc/testsuite/gcc.target/i386/call-1.c b/gcc/testsuite/gcc.target/i386/call-1.c index bd7c569c69d..a2693a315c1 100644 --- a/gcc/testsuite/gcc.target/i386/call-1.c +++ b/gcc/testsuite/gcc.target/i386/call-1.c @@ -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 index 00000000000..0dffcac6ac1 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/call-2.c @@ -0,0 +1,12 @@ +/* PR optimization/11304 */ +/* Originator: */ +/* { 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"