Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/alias-28.c

raw
1 /* { dg-do run } */
2 /* { dg-options "-O3" } */
3
4 extern void abort (void);
5 extern void __link_error (void);
6 extern void *malloc(__SIZE_TYPE__);
7
8 int * __attribute__((noinline,noclone))
9 foo (int *p)
10 {
11 int *q = (int *) malloc (sizeof (int));
12 *p = 1;
13 *q = 2;
14 if (*p != 1)
15 __link_error ();
16 *p = 3;
17 return q;
18 }
19
20 int main()
21 {
22 int i;
23 int *p = foo (&i);
24 if (i != 3 || *p != 2)
25 abort ();
26 return 0;
27 }