1 /* { dg-do run } */ 2 3 typedef unsigned int u32; 4 #if __SIZEOF_INT128__ 5 typedef unsigned long long u64; 6 typedef unsigned __int128 u128; 7 #else 8 typedef unsigned long u64; 9 typedef unsigned long long u128; 10 #endif 11 12 u128 g; 13 14 static __attribute__ ((noinline, noclone)) check(u64 a,u64 b)15void check (u64 a, u64 b) 16 { 17 if (a != 0 || b != 4) 18 __builtin_abort (); 19 } 20 21 int main(void)22main (void) 23 { 24 u64 d = (g ? 5 : 4); 25 u32 f = __builtin_sub_overflow_p (d, (u128) d, (u64) 0); 26 u128 x = g + f + d; 27 check ((x >> 1) >> (sizeof (u64) * __CHAR_BIT__ - 1), x); 28 return 0; 29 } 30