public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Resolve -Wsign-compare issue
@ 2023-05-26 11:01 Matthias Kretz
  0 siblings, 0 replies; only message in thread
From: Matthias Kretz @ 2023-05-26 11:01 UTC (permalink / raw)
  To: gcc-patches, libstdc++

[-- Attachment #1: Type: text/plain, Size: 1028 bytes --]

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
──────────────────────────────────────────────────────────────────────────

[-- Attachment #2: 0001-libstdc-Resolve-Wsign-compare-issue.patch --]
[-- Type: text/x-patch, Size: 565 bytes --]

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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-26 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-26 11:01 [committed] libstdc++: Resolve -Wsign-compare issue Matthias Kretz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).