[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #65537] Werrors from intprops-internal.h with gcc 8.3.0
From: |
Paul Eggert |
Subject: |
[bug #65537] Werrors from intprops-internal.h with gcc 8.3.0 |
Date: |
Fri, 29 Mar 2024 17:58:27 -0400 (EDT) |
Follow-up Comment #6, bug #65537 (group make):
[comment #4 comment #4:]
> In file included from lib/intprops.h:21,
> from src/arscan.c:379:
> src/arscan.c: In function ‘parse_int’:
> lib/intprops-internal.h:387:35: error: comparison of integer expressions of
different signedness: ‘int’ and ‘uintmax_t’ {aka ‘long unsigned
int’} [-Werror=sign-compare]
> : 0 < (a) && -1 - (tmin) < (a) - 1) \
> ^
This is a false alarm from old versions of GCC that suffer from GCC bug 91450.
Please try the following patch to intprops-internal.h and let me know whether
it works (I no longer use those old GCC versions). The patch should works
without your having to fiddle with MAKE_CFLAGS. If the patch works, I can
install it into Gnulib.
>From cf67e37e3a9b217c83fdcae5ce883009d94b7ae8 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@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 <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 Collin Funk <collin.funk1@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 to this item at:
<https://savannah.gnu.org/bugs/?65537>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Martin Dorey, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Paul D. Smith, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Martin Dorey, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Paul D. Smith, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Martin Dorey, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Paul Eggert, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0,
Paul Eggert <=
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Martin Dorey, 2024/03/29
- Re: [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Jeffrey Walton, 2024/03/29
- [bug #65537] Werrors from intprops-internal.h with gcc 8.3.0, Paul Eggert, 2024/03/29