gcc/
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20080522-1.c
blob75bc533f557f6425760c5d813551910e7d654b3a
1 /* This testcase is to make sure we have i in referenced vars and that we
2 properly compute aliasing for the loads and stores. */
4 extern void abort (void);
6 static int i;
7 static int *p = &i;
9 int __attribute__((noinline))
10 foo(int *q)
12 *p = 1;
13 *q = 2;
14 return *p;
17 int __attribute__((noinline))
18 bar(int *q)
20 *q = 2;
21 *p = 1;
22 return *q;
25 int main()
27 int j = 0;
29 if (foo(&i) != 2)
30 abort ();
31 if (bar(&i) != 1)
32 abort ();
33 if (foo(&j) != 1)
34 abort ();
35 if (j != 2)
36 abort ();
37 if (bar(&j) != 2)
38 abort ();
39 if (j != 2)
40 abort ();
42 return 0;