PR tree-optimization/78170: Truncate sign-extended padding when encoding bitfields
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr78170.c
blob8ef812ee6accb62db8dd6889d74032a88b784d2c
1 /* PR tree-optimization/78170.
2 Check that sign-extended store to a bitfield
3 doesn't overwrite other fields. */
5 int a, b, d;
7 struct S0
9 int f0;
10 int f1;
11 int f2;
12 int f3;
13 int f4;
14 int f5:15;
15 int f6:17;
16 int f7:2;
17 int f8:30;
18 } c;
20 void fn1 ()
22 d = b = 1;
23 for (; b; b = a)
25 struct S0 e = { 0, 0, 0, 0, 0, 0, 1, 0, 1 };
26 c = e;
27 c.f6 = -1;
31 int main ()
33 fn1 ();
34 if (c.f7 != 0)
35 __builtin_abort ();
36 return 0;