(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr56341-1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-fstrict-volatile-bitfields" } */
       3  
       4  extern void abort (void);
       5  
       6  struct test0
       7  {
       8    unsigned char b1[2];
       9  } __attribute__((packed, aligned(2)));
      10  
      11  struct test1
      12  {
      13    volatile unsigned long a1;
      14    unsigned char b1[4];
      15  } __attribute__((packed, aligned(2)));
      16  
      17  struct test2
      18  {
      19    struct test0 t0;
      20    struct test1 t1;
      21    struct test0 t2;
      22  } __attribute__((packed, aligned(2)));
      23  
      24  struct test2 xx;
      25  struct test2 *x1 = &xx;
      26  
      27  #define MAGIC 0x12345678
      28  
      29  void test0 (struct test2* x1)
      30  {
      31    x1->t1.a1 = MAGIC;
      32  }
      33  
      34  int main()
      35  {
      36    test0 (x1);
      37    if (xx.t1.a1 != MAGIC)
      38      abort ();
      39    return 0;
      40  }