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