Merged revisions 143552,143554,143557,143560,143562,143564-143567,143570-143573,14357...
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / pr39074-2.c
blob89f7ebf8cd8f9737f527d9f74724b2a27ffa77ce
1 /* { dg-do run } */
2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-options "-fdump-tree-alias" } */
4 /* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
6 #include <stdint.h>
8 int i;
9 uintptr_t __attribute__((noinline,const)) bar(int ***p) { return (uintptr_t)p; }
10 void __attribute__((noinline))
11 foo(void)
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;
23 extern void abort (void);
24 int main()
26 i = 1;
27 foo ();
28 if (i != 0)
29 abort ();
30 return 0;
33 /* { dg-final { scan-tree-dump "y.._., name memory tag: NMT..., is dereferenced, points-to vars: { i }" "alias" } } */
34 /* { dg-final { cleanup-tree-dump "alias" } } */