[gcc r16-4267] libstdc++: Fix -Wparentheses warning in std::mul_sat

Jonathan Wakely redi@gcc.gnu.org
Tue Oct 7 11:16:28 GMT 2025


https://gcc.gnu.org/g:2f399316fca1cadfde3d9e8af92e029ef00bc2da

commit r16-4267-g2f399316fca1cadfde3d9e8af92e029ef00bc2da
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Oct 1 13:53:14 2025 +0100

    libstdc++: Fix -Wparentheses warning in std::mul_sat
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/sat_arith.h (mul_sat): Add parentheses around
            operands.

Diff:
---
 libstdc++-v3/include/bits/sat_arith.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/bits/sat_arith.h b/libstdc++-v3/include/bits/sat_arith.h
index 97545d272ca7..e036fc88e40b 100644
--- a/libstdc++-v3/include/bits/sat_arith.h
+++ b/libstdc++-v3/include/bits/sat_arith.h
@@ -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;


More information about the Libstdc++-cvs mailing list