summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c')
-rw-r--r--gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c b/gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c
new file mode 100644
index 00000000000..e2661e77149
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/torture/builtin-arith-overflow-6.c
@@ -0,0 +1,21 @@
+/* Test __builtin_{add,sub,mul}_overflow. */
+/* { dg-do run { target int128 } } */
+/* { dg-skip-if "" { ! run_expensive_tests } { "*" } { "-O0" "-O2" } } */
+
+#include "builtin-arith-overflow-1.h"
+
+#define INT128_MAX ((signed __int128) (((unsigned __int128) 1 << (__SIZEOF_INT128__ * __CHAR_BIT__ - 1)) - 1))
+#define INT128_MIN (-INT128_MAX - 1)
+
+#define U(s, op) op
+TESTS (__int128, INT128_MIN, INT128_MAX)
+
+#undef T
+#define T(n, t1, t2, tr, v1, v2, vr, b, o) t##n##b ();
+
+int
+main ()
+{
+ TESTS (__int128, INT128_MIN, INT128_MAX)
+ return 0;
+}