| 1 |
// PRs 16387 and 16389 |
| 2 |
// We were treating alignof (sa.a) as alignof (typeof (sa.a)), which is |
| 3 |
// wrong for some fields. |
| 4 |
|
| 5 |
// { dg-do run } |
| 6 |
// { dg-xfail-run-if "AIX/Darwin ABI increases struct alignment for first member double" { powerpc-ibm-aix* || { ilp32 && powerpc-*-darwin* } } } |
| 7 |
|
| 8 |
extern "C" void abort(); |
| 9 |
|
| 10 |
struct A |
| 11 |
{ |
| 12 |
double a; |
| 13 |
} sa; |
| 14 |
|
| 15 |
struct B |
| 16 |
{ |
| 17 |
char c; |
| 18 |
double b; |
| 19 |
} sb; |
| 20 |
|
| 21 |
int main() |
| 22 |
{ |
| 23 |
if (__alignof (sa) != __alignof (sa.a) |
| 24 |
|| __alignof (sb) != __alignof (sb.b)) |
| 25 |
abort(); |
| 26 |
} |