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

     1  #if __SIZEOF_INT__ < 4
     2    __extension__ typedef __UINT32_TYPE__ uint32_t;
     3    __extension__ typedef __INT32_TYPE__ int32_t;
     4  #else
     5    typedef unsigned uint32_t;
     6    typedef int int32_t;
     7  #endif
     8  
     9  extern void abort (void);
    10  
    11  __attribute__ ((noinline, noclone)) unsigned long long f1 (int32_t x)
    12  {
    13    return ((unsigned long long) x) << 4;
    14  }
    15  
    16  __attribute__ ((noinline, noclone)) long long f2 (uint32_t x)
    17  {
    18    return ((long long) x) << 4;
    19  }
    20  
    21  __attribute__ ((noinline, noclone)) unsigned long long f3 (uint32_t x)
    22  {
    23    return ((unsigned long long) x) << 4;
    24  }
    25  
    26  __attribute__ ((noinline, noclone)) long long f4 (int32_t x)
    27  {
    28    return ((long long) x) << 4;
    29  }
    30  
    31  int main ()
    32  {
    33    if (f1 (0xf0000000) != 0xffffffff00000000)
    34      abort ();
    35    if (f2 (0xf0000000) != 0xf00000000)
    36      abort ();
    37    if (f3 (0xf0000000) != 0xf00000000)
    38      abort ();
    39    if (f4 (0xf0000000) != 0xffffffff00000000)
    40      abort ();
    41    return 0;
    42  }