PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr27285.c
blob44a6aaf0f010e7e65c29e0cc7f952f0c15a9f798
1 /* PR tree-optimization/27285 */
3 extern void abort (void);
5 struct S { unsigned char a, b, c, d[16]; };
7 void __attribute__ ((noinline))
8 foo (struct S *x, struct S *y)
10 int a, b;
11 unsigned char c, *d, *e;
13 b = x->b;
14 d = x->d;
15 e = y->d;
16 a = 0;
17 while (b)
19 if (b >= 8)
21 c = 0xff;
22 b -= 8;
24 else
26 c = 0xff << (8 - b);
27 b = 0;
30 e[a] = d[a] & c;
31 a++;
35 int
36 main (void)
38 struct S x = { 0, 25, 0, { 0xaa, 0xbb, 0xcc, 0xdd }};
39 struct S y = { 0, 0, 0, { 0 }};
41 foo (&x, &y);
42 if (x.d[0] != y.d[0] || x.d[1] != y.d[1]
43 || x.d[2] != y.d[2] || (x.d[3] & 0x80) != y.d[3])
44 abort ();
45 return 0;