On Sat, Feb 02, 2019 at 11:22:55AM +0100, Jakub Jelinek wrote: > The only "regression" was gcc.target/i386/call-1.c with > -fstack-protector-strong, but that is because the test is invalid: > void set_eax(int val) > { > __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val)); > } > - missing "eax" clobber or "=a" (dummy) output and when set_eax is inlined > that can break optimizations badly. Of course, in addition to fixing that, > I'd expect if the tests wants to test what it originally wanted to test, it > needs to disable inlining or perhaps all IPA opts, not sure if just for > set_eax or also for foo/bar. Perhaps we can keep the testcase as is with > the "eax" clobber and add another one with __attribute__((noipa)) on > set_eax/foo/bar.
Regardless of the PR87485 decision, I think we should fix this testcase. So here it is in patch form, regtested on x86_64-linux (\{-m32,-m32/-fstack-protector-strong,-m64,-m64/-fstack-protector-strong\}), ok for trunk? 2019-02-02 Jakub Jelinek <ja...@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. --- gcc/testsuite/gcc.target/i386/call-1.c.jj 2008-09-05 12:54:23.000000000 +0200 +++ gcc/testsuite/gcc.target/i386/call-1.c 2019-02-02 11:23:25.566902736 +0100 @@ -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) --- gcc/testsuite/gcc.target/i386/call-2.c.jj 2019-02-02 11:23:31.922797178 +0100 +++ gcc/testsuite/gcc.target/i386/call-2.c 2019-02-02 11:23:47.757534186 +0100 @@ -0,0 +1,12 @@ +/* PR optimization/11304 */ +/* Originator: <manuel.serr...@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" Jakub