diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr45982.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr45982.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr45982.c b/gcc/testsuite/gcc.dg/torture/pr45982.c new file mode 100644 index 000000000..4aea6a8d8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr45982.c @@ -0,0 +1,28 @@ +/* { dg-do run } */ +/* { dg-options "-std=c99" } */ + +#include <stdint.h> + +extern void abort (void); + +uintptr_t __attribute__((pure,noinline,noclone)) +foo (int *a) +{ + return (uintptr_t) a; +} + +void __attribute__((noinline,noclone)) +bar (uintptr_t a) +{ + int *p = (int *)a; + *p = 1; +} + +int main() +{ + int t = 0; + bar (foo (&t)); + if (t != 1) + abort (); + return 0; +} |