diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr39074-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr39074-2.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr39074-2.c b/gcc/testsuite/gcc.dg/torture/pr39074-2.c new file mode 100644 index 000000000..a90c5643d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr39074-2.c @@ -0,0 +1,34 @@ +/* { dg-do run } */ +/* { dg-require-effective-target stdint_types } */ +/* { dg-options "-fdump-tree-alias" } */ +/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */ + +#include <stdint.h> + +int i; +uintptr_t __attribute__((noinline,const)) bar(int ***p) { return (uintptr_t)p; } +void __attribute__((noinline)) +foo(void) +{ + int *y; + int **a = &y, **x; + int ***p; + uintptr_t b; + b = bar(&a); + p = (int ***)b; + x = *p; + *x = &i; /* *ANYTHING = &i has to make sure that y points to i. */ + *y = 0; +} +extern void abort (void); +int main() +{ + i = 1; + foo (); + if (i != 0) + abort (); + return 0; +} + +/* { dg-final { scan-tree-dump "y.._., points-to vars: { i }" "alias" } } */ +/* { dg-final { cleanup-tree-dump "alias" } } */ |