]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: port to ICC 2021.1 Beta 20201112
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Dec 2020 18:18:40 +0000 (10:18 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Fri, 18 Dec 2020 18:21:39 +0000 (10:21 -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
lib/intprops.h

index ae62fd779295d3a9f1afe48f0cab02aade4d22a9..c723356c11a9600dd5982f49045cbbca9a464c74 100644 (file)
--- 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.
index 2472962e6761d3c4f1c41c9684e9e128475851d7..52e60e5e2d447ec77cde832cdc36583032bfce65 100644 (file)
 
 /* 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
    _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.  */