PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 991016-1.c
blobc3122342db774ed112584d417ee49082374ef3ab
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. */
5 typedef int T0;
6 typedef long T1;
7 typedef long long T2;
9 int
10 doit(int sel, int n, void *p)
12 T0 * const p0 = p;
13 T1 * const p1 = p;
14 T2 * const p2 = p;
16 switch (sel)
18 case 0:
19 do
20 *p0 += *p0;
21 while (--n);
22 return *p0 == 0;
24 case 1:
25 do
26 *p1 += *p1;
27 while (--n);
28 return *p1 == 0;
30 case 2:
31 do
32 *p2 += *p2;
33 while (--n);
34 return *p2 == 0;
36 default:
37 abort ();
41 int
42 main()
44 T0 v0; T1 v1; T2 v2;
46 v0 = 1; doit(0, 5, &v0);
47 v1 = 1; doit(1, 5, &v1);
48 v2 = 1; doit(2, 5, &v2);
50 if (v0 != 32) abort ();
51 if (v1 != 32) abort ();
52 if (v2 != 32) abort ();
54 exit (0);