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

     1  /* powerpc64-linux gcc miscompiled this due to rs6000.c:expand_block_move
     2     not setting mem aliasing info correctly for the code implementing the
     3     structure assignment.  */
     4  
     5  struct termios
     6  {
     7    unsigned int a;
     8    unsigned int b;
     9    unsigned int c;
    10    unsigned int d;
    11    unsigned char pad[28];
    12  };
    13  
    14  struct tty_driver
    15  {
    16    unsigned char pad1[38];
    17    struct termios t __attribute__ ((aligned (8)));
    18  };
    19  
    20  static struct termios zero_t;
    21  static struct tty_driver pty;
    22  
    23  void ini (void)
    24  {
    25    pty.t = zero_t;
    26    pty.t.a = 1;
    27    pty.t.b = 2;
    28    pty.t.c = 3;
    29    pty.t.d = 4;
    30  }
    31  
    32  int main (void)
    33  {
    34    extern void abort (void);
    35  
    36    ini ();
    37    if (pty.t.a != 1
    38        || pty.t.b != 2
    39        || pty.t.c != 3
    40        || pty.t.d != 4)
    41      abort ();
    42    return 0;
    43  }