1 /* PR target/20322 */ 2 3 extern void abort (void); 4 5 typedef unsigned long T; 6 typedef struct 7 { 8 T a, b; 9 unsigned char c, d; 10 } S; 11 12 #define M (sizeof (T) * 4) 13 14 S __attribute__((noinline)) foo(T x,T y)15foo (T x, T y) 16 { 17 S e; 18 T f[2], g; 19 20 e.b = (x & (~(T) 0 >> M)) * (y & (~(T) 0 >> M)); 21 e.a = (x >> M) * (y >> M); 22 23 f[0] = (x & (~(T) 0 >> M)) * (y >> M); 24 f[1] = (x >> M) * (y & (~(T) 0 >> M)); 25 26 g = e.b; 27 e.b += (f[0] & (~(T) 0 >> M)) << M; 28 if (e.b < g) 29 e.a++; 30 31 g = e.b; 32 e.b += (f[1] & (~(T) 0 >> M)) << M; 33 if (e.b < g) 34 e.a++; 35 36 e.a += (f[0] >> M); 37 e.a += (f[1] >> M); 38 e.c = 1; 39 e.d = 0; 40 41 return e; 42 } 43 44 int main(void)45main (void) 46 { 47 T x = 1UL << (M * 2 - 1); 48 S y = foo (1, x); 49 if (y.a || y.b != x || y.c != 1 || y.d) 50 abort (); 51 return 0; 52 } 53