| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target ia32 } */ |
| 3 |
/* { dg-options "-O1 -foptimize-sibling-calls" } */ |
| 4 |
|
| 5 |
void abort (void); |
| 6 |
|
| 7 |
struct S |
| 8 |
{ |
| 9 |
void (__attribute__((__stdcall__)) *f) (struct S *); |
| 10 |
int i; |
| 11 |
}; |
| 12 |
|
| 13 |
void __attribute__((__stdcall__)) |
| 14 |
foo (struct S *s) |
| 15 |
{ |
| 16 |
s->i++; |
| 17 |
} |
| 18 |
|
| 19 |
void __attribute__((__stdcall__)) |
| 20 |
bar (struct S *s) |
| 21 |
{ |
| 22 |
foo(s); |
| 23 |
s->f(s); |
| 24 |
} |
| 25 |
|
| 26 |
int main (void) |
| 27 |
{ |
| 28 |
struct S s = { foo, 0 }; |
| 29 |
|
| 30 |
bar (&s); |
| 31 |
if (s.i != 2) |
| 32 |
abort (); |
| 33 |
|
| 34 |
return 0; |
| 35 |
} |
| 36 |
|