gcc/testsuite/gcc.dg/torture/pr69776-2.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-additional-options "-fstrict-aliasing" } */ |
| 3 | |
| 4 | extern void *malloc (__SIZE_TYPE__); |
| 5 | extern void abort (void); |
| 6 | |
| 7 | __attribute__((noinline,noclone)) |
| 8 | void f(int *qi, double *qd) |
| 9 | { |
| 10 | int i = *qi; |
| 11 | *qd = 0; |
| 12 | *qi = i; |
| 13 | } |
| 14 | |
| 15 | int main() |
| 16 | { |
| 17 | int *p = malloc(sizeof(double)); |
| 18 | |
| 19 | *p = 1; |
| 20 | f(p, (double *)p); |
| 21 | if (*p != 1) |
| 22 | abort(); |
| 23 | return 0; |
| 24 | } |
| 25 |