gcc/testsuite/gcc.c-torture/execute/pr35472.c
raw| 1 | extern void abort (void); |
| 2 | extern void *memset (void *s, int c, __SIZE_TYPE__ n); |
| 3 | struct S { int i[16]; }; |
| 4 | struct S *p; |
| 5 | void __attribute__((noinline,noclone)) |
| 6 | foo(struct S *a, struct S *b) { a->i[0] = -1; p = b; } |
| 7 | void test (void) |
| 8 | { |
| 9 | struct S a, b; |
| 10 | memset (&a.i[0], '\0', sizeof (a.i)); |
| 11 | memset (&b.i[0], '\0', sizeof (b.i)); |
| 12 | foo (&a, &b); |
| 13 | *p = a; |
| 14 | *p = b; |
| 15 | if (b.i[0] != -1) |
| 16 | abort (); |
| 17 | } |
| 18 | int main() |
| 19 | { |
| 20 | test(); |
| 21 | return 0; |
| 22 | } |