1 /* PR middle-end/37870 */ 2 /* { dg-do run } */ 3 /* { dg-options "-O2 -mlong-double-80" } */ 4 5 unsigned int foo(long double x)6foo (long double x) 7 { 8 struct { char a[8]; unsigned int b:7; } c; 9 __builtin_memcpy (&c, &x, sizeof (c)); 10 return c.b; 11 } 12 13 unsigned int bar(long double x)14bar (long double x) 15 { 16 union { struct { char a[8]; unsigned int b:7; } c; long double d; } u; 17 u.d = x; 18 return u.c.b; 19 } 20 21 int main(void)22main (void) 23 { 24 if (foo (1.245L) != bar (1.245L) 25 || foo (245.67L) != bar (245.67L) 26 || foo (0.00567L) != bar (0.00567L)) 27 __builtin_abort (); 28 return 0; 29 } 30