]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
libstdc++: Fix -Wparentheses warning in std::mul_sat
authorJonathan Wakely <jwakely@redhat.com>
Wed, 1 Oct 2025 12:53:14 +0000 (13:53 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 7 Oct 2025 11:15:28 +0000 (12:15 +0100)
libstdc++-v3/ChangeLog:

* include/bits/sat_arith.h (mul_sat): Add parentheses around
operands.

libstdc++-v3/include/bits/sat_arith.h

index 97545d272ca745597928bb1d4f3a312ef719441a..e036fc88e40bae3e2563b4c34fa72e7374ccd8d6 100644 (file)
@@ -87,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
        return __z;
       if constexpr (is_unsigned_v<_Tp>)
        return __gnu_cxx::__int_traits<_Tp>::__max;
-      else if (__x < 0 != __y < 0)
+      else if ((__x < 0) != (__y < 0))
        return __gnu_cxx::__int_traits<_Tp>::__min;
       else
        return __gnu_cxx::__int_traits<_Tp>::__max;