| 1 |
/* PR target/7559 |
| 2 |
This testcase was miscompiled on x86-64, because classify_argument |
| 3 |
wrongly computed the offset of nested structure fields. */ |
| 4 |
|
| 5 |
extern void abort (void); |
| 6 |
|
| 7 |
struct A |
| 8 |
{ |
| 9 |
long x; |
| 10 |
}; |
| 11 |
|
| 12 |
struct R |
| 13 |
{ |
| 14 |
struct A a, b; |
| 15 |
}; |
| 16 |
|
| 17 |
struct R R = { 100, 200 }; |
| 18 |
|
| 19 |
void f (struct R r) |
| 20 |
{ |
| 21 |
if (r.a.x != R.a.x || r.b.x != R.b.x) |
| 22 |
abort (); |
| 23 |
} |
| 24 |
|
| 25 |
struct R g (void) |
| 26 |
{ |
| 27 |
return R; |
| 28 |
} |
| 29 |
|
| 30 |
int main (void) |
| 31 |
{ |
| 32 |
struct R r; |
| 33 |
f(R); |
| 34 |
r = g(); |
| 35 |
if (r.a.x != R.a.x || r.b.x != R.b.x) |
| 36 |
abort (); |
| 37 |
return 0; |
| 38 |
} |