[gcc(refs/users/mikael/heads/pr121185_v01)] libstdc++: Fix hash<__int128> test for x32 [PR121150]
Mikael Morin
mikael@gcc.gnu.org
Thu Jul 24 08:05:47 GMT 2025
https://gcc.gnu.org/g:d8cbb775ef9b9775591f2f5f1af24575508b70ab
commit d8cbb775ef9b9775591f2f5f1af24575508b70ab
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Fri Jul 18 09:55:13 2025 +0100
libstdc++: Fix hash<__int128> test for x32 [PR121150]
I incorrectly assumed that all targets that support __int128 use the
LP64 ABI, so size_t is a 64-bit type. But x32 uses ILP32 and still
supports __int128 (because it's an ILP32 target on 64-bit hardware).
Add casts to the tests so that we get the correct expected values using
size_t type.
libstdc++-v3/ChangeLog:
PR libstdc++/121150
* testsuite/20_util/hash/int128.cc: Cast expected values to
size_t.
Diff:
---
libstdc++-v3/testsuite/20_util/hash/int128.cc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libstdc++-v3/testsuite/20_util/hash/int128.cc b/libstdc++-v3/testsuite/20_util/hash/int128.cc
index 7c3a1baa0ec6..a26d2e219535 100644
--- a/libstdc++-v3/testsuite/20_util/hash/int128.cc
+++ b/libstdc++-v3/testsuite/20_util/hash/int128.cc
@@ -9,12 +9,12 @@ int main()
#ifdef __SIZEOF_INT128__
std::hash<__int128> h;
__int128 i = (__int128)0x123456789;
- VERIFY( h(i) == i );
+ VERIFY( h(i) == (std::size_t)i );
VERIFY( h(-i) == (std::size_t)-i );
VERIFY( h(~i) == (std::size_t)~i );
std::hash<unsigned __int128> hu;
unsigned __int128 u = i;
- VERIFY( hu(u) == u );
+ VERIFY( hu(u) == (std::size_t)u );
VERIFY( hu(~u) == (std::size_t)~u );
#endif
}
More information about the Libstdc++-cvs
mailing list