From: Paul Eggert Date: Fri, 29 Mar 2024 22:56:45 +0000 (-0700) Subject: intprops: pacify GCC < 10 -Wsign-compare X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=257b574eed5bcc952dc496d516bbb87683d63463;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index e18c9ba506..4ad78b2ef5 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 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