|
|
31df50 |
From db8f53df0be1daeda3159c1413549ff40696c710 Mon Sep 17 00:00:00 2001
|
|
|
31df50 |
From: David Malcolm <dmalcolm@redhat.com>
|
|
|
31df50 |
Date: Thu, 2 Sep 2021 17:02:33 -0400
|
|
|
31df50 |
Subject: [PATCH 16/17] Conditionalize test for hashtable bucket sizes on
|
|
|
31df50 |
__LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
|
|
|
31df50 |
These tests were added upstream 2020-01-20 as part of:
|
|
|
31df50 |
libstdc++: Do not over-size hashtable buckets on range insertion
|
|
|
31df50 |
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=6dcf042368012e2d7ce1626ee5d378bf3ad0ccfc
|
|
|
31df50 |
|
|
|
31df50 |
but fail when run in DTS against a system libstdc++.so from an older GCC.
|
|
|
31df50 |
|
|
|
31df50 |
In particular, _M_insert_unique_node from the header is using the older
|
|
|
31df50 |
implementation of
|
|
|
31df50 |
std::__detail::_Prime_rehash_policy::_M_need_rehash
|
|
|
31df50 |
from the dynamic library.
|
|
|
31df50 |
|
|
|
31df50 |
23: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned long, unsigned long) const@GLIBCXX_3.4.18 (5)
|
|
|
31df50 |
412: 0000000000000000 0 FUNC GLOBAL DEFAULT UNDEF std::__detail::_Prime_rehash_policy::_M_need_rehash(unsigned long, unsigned long, unsigned long) const@@GLIBCXX_3.4.18
|
|
|
31df50 |
---
|
|
|
31df50 |
.../23_containers/unordered_set/cons/bucket_hint.cc | 10 ++++++++++
|
|
|
31df50 |
.../23_containers/unordered_set/modifiers/insert.cc | 9 +++++++++
|
|
|
31df50 |
2 files changed, 19 insertions(+)
|
|
|
31df50 |
|
|
|
31df50 |
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/bucket_hint.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/bucket_hint.cc
|
|
|
31df50 |
index a3b014a3a..af231e54e 100644
|
|
|
31df50 |
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/bucket_hint.cc
|
|
|
31df50 |
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/bucket_hint.cc
|
|
|
31df50 |
@@ -29,7 +29,11 @@ void test01()
|
|
|
31df50 |
a.reserve(2);
|
|
|
31df50 |
|
|
|
31df50 |
std::unordered_set<int> b({ 0, 1, 0, 1, 0, 1, 0, 1 }, a.bucket_count());
|
|
|
31df50 |
+
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( b.bucket_count() == a.bucket_count() );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
void test02()
|
|
|
31df50 |
@@ -40,7 +44,10 @@ void test02()
|
|
|
31df50 |
std::vector<int> v { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
|
|
|
31df50 |
|
|
|
31df50 |
std::unordered_set<int> b(v.begin(), v.end(), a.bucket_count());
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( b.bucket_count() == a.bucket_count() );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
void test03()
|
|
|
31df50 |
@@ -51,7 +58,10 @@ void test03()
|
|
|
31df50 |
std::forward_list<int> fl { 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 };
|
|
|
31df50 |
|
|
|
31df50 |
std::unordered_set<int> b(fl.begin(), fl.end(), a.bucket_count());
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( b.bucket_count() == a.bucket_count() );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
int main()
|
|
|
31df50 |
diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/insert.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/insert.cc
|
|
|
31df50 |
index 015c2f872..aae8298ae 100644
|
|
|
31df50 |
--- a/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/insert.cc
|
|
|
31df50 |
+++ b/libstdc++-v3/testsuite/23_containers/unordered_set/modifiers/insert.cc
|
|
|
31df50 |
@@ -30,7 +30,10 @@ void test01()
|
|
|
31df50 |
|
|
|
31df50 |
auto bkt_count = a.bucket_count();
|
|
|
31df50 |
a.insert({ 0, 1, 0, 1, 0, 1, 0, 1 });
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( a.bucket_count() == bkt_count );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
void test02()
|
|
|
31df50 |
@@ -42,7 +45,10 @@ void test02()
|
|
|
31df50 |
|
|
|
31df50 |
auto bkt_count = a.bucket_count();
|
|
|
31df50 |
a.insert(v.begin(), v.end());
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( a.bucket_count() == bkt_count );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
void test03()
|
|
|
31df50 |
@@ -54,7 +60,10 @@ void test03()
|
|
|
31df50 |
|
|
|
31df50 |
auto bkt_count = a.bucket_count();
|
|
|
31df50 |
a.insert(fl.begin(), fl.end());
|
|
|
31df50 |
+ // Fixed upstream in GCC 11
|
|
|
31df50 |
+#if __LIBSTDCXX_SO_VERSION >= 11
|
|
|
31df50 |
VERIFY( a.bucket_count() == bkt_count );
|
|
|
31df50 |
+#endif
|
|
|
31df50 |
}
|
|
|
31df50 |
|
|
|
31df50 |
int main()
|
|
|
31df50 |
--
|
|
|
31df50 |
2.31.1
|
|
|
31df50 |
|