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

     1  #if (__SIZEOF_INT__ == 2)
     2  #define TESTVALUE 0x1234
     3  #else
     4  #define TESTVALUE 0x12345678
     5  #endif
     6  static void
     7  foo (unsigned int x, void *p)
     8  {
     9    __builtin_memcpy (p, &x, sizeof x);
    10  }
    11  
    12  void
    13  bar (int type, void *number)
    14  {
    15    switch (type)
    16      {
    17      case 1:
    18        foo (TESTVALUE, number);
    19        break;
    20      case 7:
    21        foo (0, number);
    22        break;
    23      case 8:
    24        foo (0, number);
    25        break;
    26      case 9:
    27        foo (0, number);
    28        break;
    29      }
    30  }
    31  
    32  int
    33  main (void)
    34  {
    35    unsigned int x;
    36    bar (1, &x);
    37    if (x != TESTVALUE)
    38      __builtin_abort ();
    39    return 0;
    40  }