1/* Two of these types will, on current gcc targets, have the same
2   mode but have different alias sets.  DOIT tries to get gcse to
3   invalidly hoist one of the values out of the loop.  */
4
5typedef int T0;
6typedef long T1;
7typedef long long T2;
8
9int
10doit(int sel, int n, void *p)
11{
12  T0 * const p0 = p;
13  T1 * const p1 = p;
14  T2 * const p2 = p;
15
16  switch (sel)
17    {
18    case 0:
19      do
20	*p0 += *p0;
21      while (--n);
22      return *p0 == 0;
23
24    case 1:
25      do
26	*p1 += *p1;
27      while (--n);
28      return *p1 == 0;
29
30    case 2:
31      do
32	*p2 += *p2;
33      while (--n);
34      return *p2 == 0;
35
36    default:
37      abort ();
38    }
39}
40
41int
42main()
43{
44  T0 v0; T1 v1; T2 v2;
45
46  v0 = 1; doit(0, 5, &v0);
47  v1 = 1; doit(1, 5, &v1);
48  v2 = 1; doit(2, 5, &v2);
49
50  if (v0 != 32) abort ();
51  if (v1 != 32) abort ();
52  if (v2 != 32) abort ();
53
54  exit (0);
55}
56