Corrected date in changelog
[official-gcc.git] / gcc / testsuite / gcc.dg / pr35691-6.c
blobb45bbb8a2ad10667c3f59902dd36d71bd9af2704
1 /* PR middle-end/35691 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
5 __attribute__((noinline, noclone)) int
6 foo (int *p, unsigned long long *q)
8 int p0 = p[0], p10 = p[10], p12 = p[12], p32 = p[32], p77 = p[77], p85 = p[85], p86 = p[86], p97 = p[97], p98 = p[98];
9 unsigned long long q0 = q[0], q10 = q[10], q12 = q[12], q32 = q[32], q77 = q[77], q85 = q[85], q86 = q[86], q97 = q[97], q98 = q[98];
10 return p0 == 0 && q0 == -1 && p10 == 0 && q10 == -1 && p12 == 0 && q12 == -1
11 && p32 == 0 && q32 == -1 && p77 == 0 && q77 == -1 && p85 == 0 && q85 == -1
12 && p86 == 0 && q86 == -1 && p97 == 0 && q97 == -1 && p98 == 0 && q98 == -1;
15 __attribute__((noinline, noclone)) int
16 bar (int *p, unsigned long long *q)
18 int p0 = p[0], p10 = p[10], p12 = p[12], p32 = p[32], p77 = p[77], p85 = p[85], p86 = p[86], p97 = p[97], p98 = p[98];
19 unsigned long long q0 = q[0], q10 = q[10], q12 = q[12], q32 = q[32], q77 = q[77], q85 = q[85], q86 = q[86], q97 = q[97], q98 = q[98];
20 return p0 != 0 | q0 != -1 | p10 != 0 | q10 != -1 | p12 != 0 | q12 != -1
21 | p32 != 0 | q32 != -1 | p77 != 0 | q77 != -1 | p85 != 0 | q85 != -1
22 | p86 != 0 | q86 != -1 | p97 != 0 | q97 != -1 | p98 != 0 | q98 != -1;
25 int p[100];
26 unsigned long long q[100];
28 int
29 main ()
31 int i;
32 for (i = 0; i < 100; i++)
34 p[i] = 0;
35 q[i] = -1;
37 asm volatile ("" : : "g" (p), "g" (q) : "memory");
38 if (foo (p, q) != 1 || bar (p, q) != 0)
39 __builtin_abort ();
40 for (i = 0; i < 100; i++)
42 int f1, b1, f2, b2;
43 p[i] = 1;
44 f1 = foo (p, q);
45 b1 = bar (p, q);
46 p[i] = 0;
47 q[i] = 0;
48 f2 = foo (p, q);
49 b2 = bar (p, q);
50 q[i] = -1;
51 switch (i)
53 case 0:
54 case 10:
55 case 12:
56 case 32:
57 case 77:
58 case 85:
59 case 86:
60 case 97:
61 case 98:
62 if (f1 != 0 || b1 != 1 || f2 != 0 || b2 != 1)
63 __builtin_abort ();
64 break;
65 default:
66 if (f1 != 1 || b1 != 0 || f2 != 1 || b2 != 0)
67 __builtin_abort ();
68 break;
71 return 0;