From c63bfe086219aa01d64a2fbdf1ca5b2253682802 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 29 Mar 2024 15:56:45 -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 | 6 ++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 86b75a14de..b30518785c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-03-29 Paul Eggert + + 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 attribute: Work around compiler bug of Oracle cc 12.6. diff --git a/lib/intprops-internal.h b/lib/intprops-internal.h index 0467a9ca8f..69b401fda1 100644 --- a/lib/intprops-internal.h +++ b/lib/intprops-internal.h @@ -1,6 +1,6 @@ /* intprops-internal.h -- properties of integer types not visible to users - Copyright (C) 2001-2023 Free Software Foundation, Inc. + Copyright (C) 2001-2024 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published @@ -164,7 +164,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.39.5