On 3/29/24 13:14, Paul Smith wrote:
I have a bug report for a compiler error in GNU Make, using
intprops-internal.h, on Debian 10 with GCC 8.3:

https://savannah.gnu.org/bugs/?65537

This is a false alarm from that old GCC version. I suggested to the original bug reporter to try the attached patch; if that works we can install this patch into Gnulib.
From cf67e37e3a9b217c83fdcae5ce883009d94b7ae8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <egg...@cs.ucla.edu>
Date: Fri, 29 Mar 2024 14:34:27 -0700
Subject: [PATCH] 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.
---
 ChangeLog               | 9 +++++++++
 lib/intprops-internal.h | 4 +++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 931322915b..f967275871 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-03-29  Paul Eggert  <egg...@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  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Display specified modules in bold.
diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h
index c8a87d2bb2..b5ba8d7cbd 100644
--- a/lib/intprops-internal.h
+++ b/lib/intprops-internal.h
@@ -169,7 +169,9 @@
    /* 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
-- 
2.44.0

Reply via email to