| 1 |
/* PR optimization/11304 */ |
| 2 |
/* Originator: <[email protected]> */ |
| 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 |
|
| 12 |
void set_eax(int val) |
| 13 |
{ |
| 14 |
__asm__ __volatile__ ("mov %0, %%eax" : : "m" (val) : "eax"); |
| 15 |
} |
| 16 |
|
| 17 |
void foo(int val) |
| 18 |
{ |
| 19 |
r = val; |
| 20 |
} |
| 21 |
|
| 22 |
int bar(int x) |
| 23 |
{ |
| 24 |
if (x) |
| 25 |
{ |
| 26 |
set_eax(0); |
| 27 |
return x; |
| 28 |
} |
| 29 |
|
| 30 |
foo(x); |
| 31 |
} |
| 32 |
|
| 33 |
int main(void) |
| 34 |
{ |
| 35 |
if (bar(1) != 1) |
| 36 |
abort(); |
| 37 |
|
| 38 |
return 0; |
| 39 |
} |