]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.dg/torture/pr86438.c
3e95515ae6a6b4df66cfb0b4ce9ddfb96a130d1f
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / torture / pr86438.c
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))
15 void check (u64 a, u64 b)
16 {
17 if (a != 0 || b != 4)
18 __builtin_abort ();
19 }
20
21 int
22 main (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 >> (sizeof (u64) * __CHAR_BIT__), x);
28 return 0;
29 }