modernc.org/ccgo/v3@v3.16.14/lib/testdata/gcc-9.1.0/gcc/testsuite/gcc.c-torture/execute/pr41317.c (about)

     1  extern void abort (void);
     2  
     3  struct A
     4  {
     5    int i;
     6  };
     7  struct B
     8  {
     9    struct A a;
    10    int j;
    11  };
    12  
    13  static void
    14  foo (struct B *p)
    15  {
    16    ((struct A *)p)->i = 1;
    17  }
    18  
    19  int main()
    20  {
    21    struct A a;
    22    a.i = 0;
    23    foo ((struct B *)&a);
    24    if (a.i != 1)
    25      abort ();
    26    return 0;
    27  }
    28