[committed] libstdc++: Resolve -Wsign-compare issue

Message ID 24154111.EfDdHjke4D@minbar
State Accepted
Headers
Series [committed] libstdc++: Resolve -Wsign-compare issue |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Matthias Kretz May 26, 2023, 11:01 a.m. UTC
  pushed to master, will backport later

tested on x86_64-pc-linux-gnu and powerpc64le-linux-gnu

----------- 8< ------------


Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_ppc.h (_S_bit_shift_left):
	Negative __y is UB, so prefer signed compare.
---
 libstdc++-v3/include/experimental/bits/simd_ppc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
──────────────────────────────────────────────────────────────────────────
 Dr. Matthias Kretz                           https://mattkretz.github.io
 GSI Helmholtz Centre for Heavy Ion Research               https://gsi.de
 stdₓ::simd
──────────────────────────────────────────────────────────────────────────
  

Patch

diff --git a/libstdc++-v3/include/experimental/bits/simd_ppc.h b/libstdc++-v3/include/experimental/bits/simd_ppc.h
index 2ea7234bd99..34daa530f02 100644
--- a/libstdc++-v3/include/experimental/bits/simd_ppc.h
+++ b/libstdc++-v3/include/experimental/bits/simd_ppc.h
@@ -64,7 +64,7 @@  _S_bit_shift_left(_SimdWrapper<_Tp, _Np> __x, int __y)
 	__x = _Base::_S_bit_shift_left(__x, __y);
 	if constexpr (sizeof(_Tp) < sizeof(int))
 	  {
-	    if (__y >= sizeof(_Tp) * __CHAR_BIT__)
+	    if (__y >= int(sizeof(_Tp) * __CHAR_BIT__))
 	      return {};
 	  }
 	return __x;