(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
pr78170.c
       1  /* { dg-require-effective-target int32plus } */
       2  
       3  /* PR tree-optimization/78170.
       4     Check that sign-extended store to a bitfield
       5     doesn't overwrite other fields.  */
       6  
       7  int a, b, d;
       8  
       9  struct S0
      10  {
      11    int f0;
      12    int f1;
      13    int f2;
      14    int f3;
      15    int f4;
      16    int f5:15;
      17    int f6:17;
      18    int f7:2;
      19    int f8:30;
      20  } c;
      21  
      22  void fn1 ()
      23  {
      24    d = b = 1;
      25    for (; b; b = a)
      26      {
      27        struct S0 e = { 0, 0, 0, 0, 0, 0, 1, 0, 1 };
      28        c = e;
      29        c.f6 = -1;
      30      }
      31  }
      32  
      33  int main ()
      34  {
      35    fn1 ();
      36    if (c.f7 != 0)
      37      __builtin_abort ();
      38    return 0;
      39  }