blob: e9811ce12b58b0b0b5735cccadadaa82baea42c3 (
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
30
31
32
33
34
35
36
37
|
/* { dg-do run } */
/* { dg-options "-O1" } */
struct with_hole {
int x;
long y;
};
struct without_hole {
int x;
int y;
};
union u {
struct with_hole with_hole;
struct without_hole without_hole;
};
void __attribute__((noinline))
test (union u *up, union u u)
{
union u u2;
volatile int f = 0;
u2 = u;
if (f)
u2.with_hole = u.with_hole;
*up = u2;
}
int main(void)
{
union u u;
union u u2;
u2.without_hole.y = -1;
test (&u, u2);
if (u.without_hole.y != -1)
__builtin_abort ();
return 0;
}
|