1/* PR tree-optimization/27285 */ 2 3extern void abort (void); 4 5struct S { unsigned char a, b, c, d[16]; }; 6 7void __attribute__ ((noinline)) 8foo (struct S *x, struct S *y) 9{ 10 int a, b; 11 unsigned char c, *d, *e; 12 13 b = x->b; 14 d = x->d; 15 e = y->d; 16 a = 0; 17 while (b) 18 { 19 if (b >= 8) 20 { 21 c = 0xff; 22 b -= 8; 23 } 24 else 25 { 26 c = 0xff << (8 - b); 27 b = 0; 28 } 29 30 e[a] = d[a] & c; 31 a++; 32 } 33} 34 35int 36main (void) 37{ 38 struct S x = { 0, 25, 0, { 0xaa, 0xbb, 0xcc, 0xdd }}; 39 struct S y = { 0, 0, 0, { 0 }}; 40 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; 46} 47