]> Savannah Git Hosting - gnulib.git/commitdiff
intprops: pacify GCC < 10 -Wsign-compare
authorPaul Eggert <eggert@cs.ucla.edu>
Fri, 29 Mar 2024 22:56:45 +0000 (15:56 -0700)
committerBruno Haible <bruno@clisp.org>
Mon, 8 Apr 2024 10:26:03 +0000 (12:26 +0200)
Problem reported by Martin Dorey in:
https://savannah.gnu.org/bugs/index.php?65537
* lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
When working around GCC bug 91450, pacify -Wsign-compare by
casting 0 to the result type.

ChangeLog
lib/intprops-internal.h

index e18c9ba506f7a97f69c8a6f26a8fd989f974af11..4ad78b2ef5c4802bf532899ea3c2b364b5198653 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-29  Paul Eggert  <eggert@cs.ucla.edu>
+
+       intprops: pacify GCC < 10 -Wsign-compare
+       Problem reported by Martin Dorey in:
+       https://savannah.gnu.org/bugs/index.php?65537
+       * lib/intprops-internal.h (_GL_INT_MULTIPLY_WRAPV):
+       When working around GCC bug 91450, pacify -Wsign-compare by
+       casting 0 to the result type.
+
 2024-03-29  Bruno Haible  <bruno@clisp.org>
 
        attribute: Work around compiler bug of Oracle cc 12.6.
index c8a87d2bb27bc0643b0315c9aa0b907a41987776..b5ba8d7cbd25f4c9a40b8b979b859d54ca26ba25 100644 (file)
    /* Work around GCC bug 91450.  */
 #  define _GL_INT_MULTIPLY_WRAPV(a, b, r) \
     ((!_GL_SIGNED_TYPE_OR_EXPR (*(r)) && _GL_EXPR_SIGNED (a) && _GL_EXPR_SIGNED (b) \
-      && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, 0, (__typeof__ (*(r))) -1)) \
+      && _GL_INT_MULTIPLY_RANGE_OVERFLOW (a, b, \
+                                          (__typeof__ (*(r))) 0, \
+                                          (__typeof__ (*(r))) -1)) \
      ? ((void) __builtin_mul_overflow (a, b, r), 1) \
      : __builtin_mul_overflow (a, b, r))
 # endif