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

     1  #if (__SIZEOF_INT__ == 4)
     2  typedef int int32;
     3  #elif (__SIZEOF_LONG__ == 4)
     4  typedef long int32;
     5  #else
     6  #error Add target support for int32
     7  #endif
     8  static int32 ref(void)
     9  {
    10    union {
    11      char c[5];
    12      int32 i;
    13    } u;
    14  
    15    __builtin_memset (&u, 0, sizeof(u));
    16    u.c[0] = 1;
    17    u.c[1] = 2;
    18    u.c[2] = 3;
    19    u.c[3] = 4;
    20  
    21    return u.i;
    22  }
    23  
    24  int main()
    25  {
    26    int32 b = ref();
    27    if (b != 0x01020304
    28        && b != 0x04030201)
    29      abort ();
    30    return 0;
    31  }