gcc/testsuite/gcc.dg/torture/pr45982.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-std=c99" } */ |
| 3 | |
| 4 | #include <stdint.h> |
| 5 | |
| 6 | extern void abort (void); |
| 7 | |
| 8 | uintptr_t __attribute__((pure,noinline,noclone)) |
| 9 | foo (int *a) |
| 10 | { |
| 11 | return (uintptr_t) a; |
| 12 | } |
| 13 | |
| 14 | void __attribute__((noinline,noclone)) |
| 15 | bar (uintptr_t a) |
| 16 | { |
| 17 | int *p = (int *)a; |
| 18 | *p = 1; |
| 19 | } |
| 20 | |
| 21 | int main() |
| 22 | { |
| 23 | int t = 0; |
| 24 | bar (foo (&t)); |
| 25 | if (t != 1) |
| 26 | abort (); |
| 27 | return 0; |
| 28 | } |