gcc/testsuite/gcc.c-torture/execute/pr114207.c
raw| 1 | #include <stdio.h> |
| 2 | #include <stdint.h> |
| 3 | |
| 4 | struct S { |
| 5 | int a, b; |
| 6 | }; |
| 7 | |
| 8 | __attribute__((noinline)) |
| 9 | void foo (struct S *s) { |
| 10 | struct S ss = (struct S) { |
| 11 | .a = s->b, |
| 12 | .b = s->a |
| 13 | }; |
| 14 | *s = ss; |
| 15 | } |
| 16 | |
| 17 | int main() { |
| 18 | struct S s = {6, 12}; |
| 19 | foo(&s); |
| 20 | if (s.a != 12 || s.b != 6) |
| 21 | __builtin_abort (); |
| 22 | return 0; |
| 23 | } |