[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] intprops: port to ICC 2021.1 Beta 20201112
From: |
Paul Eggert |
Subject: |
[PATCH] intprops: port to ICC 2021.1 Beta 20201112 |
Date: |
Fri, 18 Dec 2020 10:23:30 -0800 |
* lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P):
Port to ICC 2021.1, which has a non-working __builtin_mul_overflow_p.
Add a clause for other compilers that claim to support
__builtin_mul_overflow_p, since we might as well find out about
slackers other than Clang and ICC.
(INT_MULTIPLY_WRAPV): ICC 2021 has GCC bug 91450, so treat it
like older GCCs even when it claims to be a newer one.
---
ChangeLog | 11 +++++++++++
lib/intprops.h | 15 ++++++++++-----
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ae62fd779..c723356c1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2020-12-18 Paul Eggert <eggert@cs.ucla.edu>
+
+ intprops: port to ICC 2021.1 Beta 20201112
+ * lib/intprops.h (_GL_HAS_BUILTIN_OVERFLOW_P):
+ Port to ICC 2021.1, which has a non-working __builtin_mul_overflow_p.
+ Add a clause for other compilers that claim to support
+ __builtin_mul_overflow_p, since we might as well find out about
+ slackers other than Clang and ICC.
+ (INT_MULTIPLY_WRAPV): ICC 2021 has GCC bug 91450, so treat it
+ like older GCCs even when it claims to be a newer one.
+
2020-12-18 Bruno Haible <bruno@clisp.org>
intprops: Avoid potentially buggy __builtin_add_overflow in GCC 5, 6.
diff --git a/lib/intprops.h b/lib/intprops.h
index 2472962e6..52e60e5e2 100644
--- a/lib/intprops.h
+++ b/lib/intprops.h
@@ -246,10 +246,14 @@
/* True if __builtin_add_overflow_p (A, B, C) works, and similarly for
__builtin_sub_overflow_p and __builtin_mul_overflow_p. */
-#ifdef __clang__
-/* Clang 9 lacks __builtin_mul_overflow_p, and even if it did it would
- presumably run afoul of Clang bug 16404. */
+#if defined __clang__ || defined __ICC
+/* Clang 11 lacks __builtin_mul_overflow_p, and even if it did it
+ would presumably run afoul of Clang bug 16404. ICC 2021.1's
+ __builtin_add_overflow_p etc. are not treated as integral constant
+ expressions even when all arguments are. */
# define _GL_HAS_BUILTIN_OVERFLOW_P 0
+#elif defined __has_builtin
+# define _GL_HAS_BUILTIN_OVERFLOW_P __has_builtin (__builtin_mul_overflow_p)
#else
# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__)
#endif
@@ -385,8 +389,9 @@
_GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
#endif
#if _GL_HAS_BUILTIN_MUL_OVERFLOW
-# if (9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
- || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__))
+# if ((9 < __GNUC__ + (3 <= __GNUC_MINOR__) \
+ || (__GNUC__ == 8 && 4 <= __GNUC_MINOR__)) \
+ && !defined __ICC)
# define INT_MULTIPLY_WRAPV(a, b, r) __builtin_mul_overflow (a, b, r)
# else
/* Work around GCC bug 91450. */
--
2.27.0
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] intprops: port to ICC 2021.1 Beta 20201112,
Paul Eggert <=