backport: re PR rtl-optimization/11304 (Wrong code production with -fomit-frame-pointer)

Backported from mainline
	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.

From-SVN: r275102
This commit is contained in:
Jakub Jelinek 2019-08-30 13:43:04 +02:00 committed by Jakub Jelinek
parent 034762a665
commit ddb4546b61
3 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,10 @@
Backported from mainline
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.
PR target/89188
* g++.dg/opt/pr89188.C: New test.

View 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)

View File

@ -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__((noinline, noclone)) void set_eax(int val);
__attribute__((noinline, noclone)) void foo(int val);
__attribute__((noinline, noclone)) int bar(int x);
#include "call-1.c"