| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
#define numwords 2 |
| 4 |
|
| 5 |
typedef struct { |
| 6 |
unsigned words[numwords]; |
| 7 |
} Child; |
| 8 |
|
| 9 |
typedef struct { |
| 10 |
Child child; |
| 11 |
} Parent; |
| 12 |
|
| 13 |
Parent my_or(Parent x, const Parent *y) { |
| 14 |
const Child *y_child = &y->child; |
| 15 |
for (int i = 0; i < numwords; i++) { |
| 16 |
x.child.words[i] |= y_child->words[i]; |
| 17 |
} |
| 18 |
return x; |
| 19 |
} |
| 20 |
|
| 21 |
int main() { |
| 22 |
Parent bs[4]; |
| 23 |
__builtin_memset(bs, 0, sizeof(bs)); |
| 24 |
|
| 25 |
bs[0].child.words[0] = 1; |
| 26 |
for (int i = 1; i <= 3; i++) { |
| 27 |
bs[i] = my_or(bs[i], &bs[i - 1]); |
| 28 |
} |
| 29 |
if (bs[2].child.words[0] != 1) |
| 30 |
__builtin_abort (); |
| 31 |
return 0; |
| 32 |
} |