* gcc.c-torture/execute/20101011-1.c: Skip on SH.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr15262-1.c
blobf6a6fe40b73b8181eee778151e348dc0ab8ecb66
1 /* PR 15262.
2 The alias analyzer only considers relations between pointers and
3 symbols. If two pointers P and Q point to the same symbol S, then
4 their respective memory tags will either be the same or they will
5 have S in their alias set.
7 However, if there are no common symbols between P and Q, TBAA will
8 currently miss their alias relationship altogether. */
9 struct A
11 int t;
12 int i;
15 int foo () { return 3; }
17 main ()
19 struct A loc, *locp;
20 float f, g, *p;
21 int T355, *T356;
23 /* Avoid the partial hack in TBAA that would consider memory tags if
24 the program had no addressable symbols. */
25 f = 3;
26 g = 2;
27 p = foo () ? &g : &f;
28 if (*p > 0.0)
29 g = 1;
31 /* Store into *locp and cache its current value. */
32 locp = malloc (sizeof (*locp));
33 locp->i = 10;
34 T355 = locp->i;
36 /* Take the address of one of locp's fields and write to it. */
37 T356 = &locp->i;
38 *T356 = 1;
40 /* Read the recently stored value. If TBAA fails, this will appear
41 as a redundant load that will be replaced with '10'. */
42 T355 = locp->i;
43 if (T355 != 1)
44 abort ();
46 return 0;