| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target stdint_types } */ |
| 3 |
/* { dg-options "-fdump-tree-alias-details" } */ |
| 4 |
/* { dg-skip-if "" { *-*-* } { "-O0" "-fno-fat-lto-objects" } { "" } } */ |
| 5 |
|
| 6 |
#include <stdint.h> |
| 7 |
|
| 8 |
int i; |
| 9 |
uintptr_t __attribute__((noinline,const)) bar(int ***p) { return (uintptr_t)p; } |
| 10 |
void __attribute__((noinline)) |
| 11 |
foo(void) |
| 12 |
{ |
| 13 |
int *y; |
| 14 |
int **a = &y, **x; |
| 15 |
int ***p; |
| 16 |
uintptr_t b; |
| 17 |
b = bar(&a); |
| 18 |
p = (int ***)b; |
| 19 |
x = *p; |
| 20 |
*x = &i; /* *ANYTHING = &i has to make sure that y points to i. */ |
| 21 |
*y = 0; |
| 22 |
} |
| 23 |
extern void abort (void); |
| 24 |
int main() |
| 25 |
{ |
| 26 |
i = 1; |
| 27 |
foo (); |
| 28 |
if (i != 0) |
| 29 |
abort (); |
| 30 |
return 0; |
| 31 |
} |
| 32 |
|
| 33 |
/* { dg-final { scan-tree-dump "y.\?.._. = { i }" "alias" } } */ |
| 34 |
/* { dg-final { scan-tree-dump "y.\?.._., points-to NULL, points-to vars: { D..... }" "alias" } } */ |