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

     1  /* PR middle-end/87623 */
     2  /* Testcase by George Thopas <george.thopas@gmail.com> */
     3  
     4  struct be {
     5      unsigned short pad[1];
     6      unsigned char  a;
     7      unsigned char  b;
     8  } __attribute__((scalar_storage_order("big-endian")));
     9  
    10  typedef struct be t_be;
    11  
    12  struct le {
    13      unsigned short pad[3];
    14      unsigned char  a;
    15      unsigned char  b;
    16  };
    17  
    18  typedef struct le t_le;
    19  
    20  int a_or_b_different(t_be *x,t_le *y)
    21  {
    22     return (x->a != y->a) || (x->b != y->b);
    23  }
    24  
    25  int main (void)
    26  {
    27     t_be x = { .a=1, .b=2  };
    28     t_le y = { .a=1, .b=2  };
    29    
    30     if (a_or_b_different(&x,&y))
    31         __builtin_abort ();
    32  
    33     return 0;
    34  }