| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-skip-if "small alignment" { pdp11-*-* } } */ |
| 3 |
|
| 4 |
extern void abort (void); |
| 5 |
|
| 6 |
typedef struct Bar { |
| 7 |
char c[129]; |
| 8 |
} Bar __attribute__((__aligned__(128))); |
| 9 |
|
| 10 |
typedef struct Foo { |
| 11 |
Bar bar[4]; /* { dg-error "size of array element is not a multiple of its alignment" } */ |
| 12 |
} Foo; |
| 13 |
|
| 14 |
Foo foo[4]; |
| 15 |
|
| 16 |
int main() |
| 17 |
{ |
| 18 |
int i, j; |
| 19 |
Foo *foop = &foo[0]; |
| 20 |
|
| 21 |
for (i=0; i < 4; i++) { |
| 22 |
Bar *bar = &foop->bar[i]; |
| 23 |
for (j=0; j < 129; j++) { |
| 24 |
bar->c[j] = 'a' + i; |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
if (foo[0].bar[3].c[128] != 'd') |
| 29 |
abort (); |
| 30 |
return 0; |
| 31 |
} |