[7/8] libstdc++: Fix -Wsign-compare issue

Message ID 838576767.0ifERbkFSE@minbar
State Repeat Merge
Headers
Series std::experimental::simd patchset |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Matthias Kretz Feb. 23, 2023, 8:50 a.m. UTC
  Signed-off-by: Matthias Kretz <m.kretz@gsi.de>

libstdc++-v3/ChangeLog:

	* include/experimental/bits/simd_builtin.h (_S_set): Compare as
	int. The actual range of these indexes is very small.
---
 libstdc++-v3/include/experimental/bits/simd_builtin.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
──────────────────────────────────────────────────────────────────────────
  

Comments

Jonathan Wakely Feb. 23, 2023, 11:07 a.m. UTC | #1
On Thu, 23 Feb 2023 at 08:51, Matthias Kretz via Libstdc++
<libstdc++@gcc.gnu.org> wrote:
>
>

OK for all branches.

> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
>         * include/experimental/bits/simd_builtin.h (_S_set): Compare as
>         int. The actual range of these indexes is very small.
> ---
>  libstdc++-v3/include/experimental/bits/simd_builtin.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_builtin.h b/libstdc++-v3/include/experimental/bits/simd_builtin.h
index 0e75f941288..30bbfa7d478 100644
--- a/libstdc++-v3/include/experimental/bits/simd_builtin.h
+++ b/libstdc++-v3/include/experimental/bits/simd_builtin.h
@@ -2875,7 +2875,7 @@  _S_bit_xor(const _SimdWrapper<_Tp, _Np>& __x, const _SimdWrapper<_Tp, _Np>& __y)
 		__k = __generate_from_n_evaluations<_Np,
 						    __vector_type_t<_Tp, _Np>>(
 		  [&](auto __j) _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA {
-		    if (__i == __j)
+		    if (__i == static_cast<int>(__j))
 		      return _Tp(-__x);
 		    else
 		      return __k[+__j];