1 /* PR optimization/11304 */ 2 /* Originator: <manuel.serrano@sophia.inria.fr> */ 3 /* { dg-do run } */ 4 /* { dg-options "-O -fomit-frame-pointer" } */ 5 6 /* Verify that %eax is always restored after a call. */ 7 8 extern void abort(void); 9 10 volatile int r; 11 set_eax(int val)12void set_eax(int val) 13 { 14 __asm__ __volatile__ ("mov %0, %%eax" : : "m" (val) : "eax"); 15 } 16 foo(int val)17void foo(int val) 18 { 19 r = val; 20 } 21 bar(int x)22int bar(int x) 23 { 24 if (x) 25 { 26 set_eax(0); 27 return x; 28 } 29 30 foo(x); 31 } 32 main(void)33int main(void) 34 { 35 if (bar(1) != 1) 36 abort(); 37 38 return 0; 39 } 40