on ARRAY_REFs sign-extend offsets only from sizetype's precision [PR98255]
[gcc.git] / gcc / testsuite / gcc.dg / pr98255.c
1 /* PR tree-optimization/98255 */
2 /* { dg-do run } */
3 /* { dg-options "-Os" } */
4 /* { dg-additional-options "-fPIC" { target fpic } } */
5
6 struct A { volatile unsigned b; unsigned c; };
7 int d, *e, h, k, l;
8 static struct A f;
9 long g;
10 static unsigned i = -2U;
11 volatile int j;
12
13 long
14 foo (void)
15 {
16 char n[4][4][3]
17 = { { {9, 2, 8}, {9, 2, 8}, {9, 2, 8}, {9} }, { {8} }, { {8} }, { {2} } };
18 while (d)
19 {
20 for (; f.c < 4; f.c++)
21 {
22 *e = 0;
23 h = n[f.c + 4][0][d];
24 }
25 while (g)
26 return n[0][3][i];
27 while (1)
28 {
29 if (k)
30 {
31 j = 0;
32 if (j)
33 continue;
34 }
35 if (l)
36 break;
37 }
38 }
39 return 0;
40 }
41
42 int
43 main ()
44 {
45 asm volatile ("" : "+g" (d), "+g" (g), "+g" (f.c));
46 asm volatile ("" : "+g" (e), "+g" (k), "+g" (l));
47 foo ();
48 return 0;
49 }