From b8b828de7735e653d8f1c0b692b91cb03119e219 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:09:45 +0200 Subject: [PATCH 01/14] isolated and instrumented test_gh348_2 --- .../boost/unordered/detail/implementation.hpp | 10 +- test/Jamfile.v2 | 396 ------------------ test/unordered/rehash_tests.cpp | 3 + 3 files changed, 12 insertions(+), 397 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 23a5776bc..c632a1743 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,10 +954,13 @@ namespace boost { inline std::size_t double_to_size(double f) { - return f >= static_cast( + std::cout << " double_to_size\n"; + auto ret = f >= static_cast( (std::numeric_limits::max)()) ? (std::numeric_limits::max)() : static_cast(f); + std::cout << " ret: " << ret << "\n"; + return ret; } ////////////////////////////////////////////////////////////////////////// @@ -1781,8 +1784,10 @@ namespace boost { static std::size_t min_buckets(std::size_t num_elements, float mlf) { + std::cout << " min_buckets\n"; std::size_t num_buckets = boost::unordered::detail::double_to_size( std::ceil(static_cast(num_elements) / mlf)); + std::cout << " num_buckets: " << num_buckets << "\n"; if (num_buckets == 0 && num_elements > 0) { // mlf == inf num_buckets = 1; @@ -2704,7 +2709,10 @@ namespace boost { template inline void table::reserve(std::size_t num_elements) { + std::cout << "reserve\n"; + std::cout << " num_elements: " << num_elements << "\n"; std::size_t num_buckets = min_buckets(num_elements, mlf_); + std::cout << " num_buckets: " << num_buckets << "\n"; this->rehash(num_buckets); } diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 31265e458..6d3a698e7 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -40,409 +40,13 @@ project path-constant BOOST_UNORDERED_TEST_DIR : . ; -run quick.cpp ; - -compile debuggability/visualization_tests.cpp - : cygwin:_XOPEN_SOURCE=600 - ; - -compile unordered/self_include_tests_obj.cpp - : BOOST_UNORDERED_HEADER="boost/unordered_map.hpp" - : tl_unordered_map_hpp ; - -compile unordered/self_include_tests_obj.cpp - : BOOST_UNORDERED_HEADER="boost/unordered_set.hpp" - : tl_unordered_set_hpp ; - -local include_root = [ path.make $(TOP)/../include ] ; -local headers = [ path.glob-tree $(include_root)/boost/unordered : *.hpp ] ; - -local paths ; -local sanitized_paths ; - -for local header in $(headers) -{ - local path = [ path.relative-to $(include_root) $(header) ] ; - - local sanitized = [ path.relative-to "$(include_root)/boost/unordered" $(header) ] ; - sanitized = [ regex.replace $(sanitized) "[/.\\]" "_" ] ; - - paths += $(path) ; - sanitized_paths += $(sanitized) ; - - compile unordered/self_include_tests_obj.cpp - : BOOST_UNORDERED_HEADER="$(path)" : $(sanitized) ; -} - -alias include_tests - : tl_unordered_map_hpp - tl_unordered_set_hpp - $(sanitized_paths) ; local FCA_TESTS = - allocator_traits - assign_tests - at_tests - bucket_tests - compile_map - compile_set - constructor_tests - contains_tests - copy_tests - deduction_tests - emplace_smf_tests - emplace_tests - equality_tests - equivalent_keys_tests - erase_equiv_tests - erase_if - erase_tests - explicit_alloc_ctor_tests - extract_tests - find_tests - fwd_map_test - fwd_set_test - incomplete_test - insert_hint_tests - insert_stable_tests - insert_tests - load_factor_tests - merge_tests - minimal_allocator - move_tests - narrow_cast_tests - node_handle_tests - node_handle_allocator_tests - noexcept_tests - post_move_tests - prime_fmod_tests - rehash_tests reserve_tests - scary_tests - scoped_allocator - simple_tests - swap_tests - transparent_tests - unnecessary_copy_tests - fancy_pointer_noleak - pmr_allocator_tests ; -for local test in $(FCA_TESTS) -{ - if $(test) = "erase_tests" { - run unordered/$(test).cpp : : : BOOST_UNORDERED_SUPPRESS_DEPRECATED ; - } else if $(test) = "scoped_allocator" { - run unordered/$(test).cpp : : : msvc-14.0:no ; - } else { - run unordered/$(test).cpp ; - } -} - -run unordered/link_test_1.cpp unordered/link_test_2.cpp : : : : link_test ; -run unordered/serialization_tests.cpp - : $(BOOST_UNORDERED_TEST_DIR) - : - : BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0 - off # Boost.Serialization headers are not warning-free - norecover:no # boost::archive::xml_oarchive does not pass UBSAN - msvc:_CRT_SECURE_NO_WARNINGS - msvc:/bigobj - gcc:on - gcc:space - clang:on - clang:space - /boost/serialization//boost_serialization/off - /boost/container//boost_container/off - gcc,windows:no ; # Boost.Atomic no longer supports MinGW - -compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MAP : insert_node_type_fail_map ; -compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MULTIMAP : insert_node_type_fail_multimap ; -compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_SET : insert_node_type_fail_set ; -compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MULTISET : insert_node_type_fail_multiset ; - -compile unordered/explicit_instantiation_tests.cpp : : fca_explicit_instantiation_tests ; -compile unordered/explicit_instantiation_tests.cpp : BOOST_UNORDERED_FOA_TESTS : foa_explicit_instantiation_tests ; -compile cfoa/explicit_instantiation_tests.cpp : : cfoa_explicit_instantiation_tests ; - -compile unordered/conversion_operator_tests.cpp : BOOST_UNORDERED_FOA_TESTS : foa_conversion_operator_tests ; -compile cfoa/conversion_operator_tests.cpp : : cfoa_conversion_operator_tests ; - -local FCA_EXCEPTION_TESTS = - constructor_exception_tests - copy_exception_tests - assign_exception_tests - move_assign_exception_tests - insert_exception_tests - erase_exception_tests - rehash_exception_tests - merge_exception_tests - less_tests - swap_exception_tests -; - -for local test in $(FCA_EXCEPTION_TESTS) -{ - if $(test) = "swap_exception_tests" { - run exception/$(test).cpp : : : BOOST_UNORDERED_SWAP_METHOD=2 ; - } else { - run exception/$(test).cpp ; - } -} - -alias fca_exception_tests : $(FCA_EXCEPTION_TESTS) ; alias fca_tests : $(FCA_TESTS) - $(FCA_EXCEPTION_TESTS) - link_test - insert_node_type_fail_map - insert_node_type_fail_multimap - insert_node_type_fail_set - insert_node_type_fail_multiset - serialization_tests -; - -local FOA_TESTS = - fwd_set_test - fwd_map_test - compile_set - compile_map - noexcept_tests - incomplete_test - simple_tests - equivalent_keys_tests - constructor_tests - copy_tests - move_tests - post_move_tests - assign_tests - insert_tests - insert_hint_tests - emplace_smf_tests - emplace_tests - erase_tests - explicit_alloc_ctor_tests - merge_tests - find_tests - at_tests - load_factor_tests - rehash_tests - equality_tests - swap_tests - transparent_tests - reserve_tests - contains_tests - erase_if - scary_tests - init_type_insert_tests - max_load_tests - extract_tests - node_handle_tests - uses_allocator - hash_is_avalanching_test - fancy_pointer_noleak - pmr_allocator_tests - pull_tests - stats_tests - node_handle_allocator_tests ; -for local test in $(FOA_TESTS) -{ - run unordered/$(test).cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_$(test) ; -} - -run unordered/link_test_1.cpp unordered/link_test_2.cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_link_test ; -run unordered/scoped_allocator.cpp : : : msvc-14.0:no BOOST_UNORDERED_FOA_TESTS : foa_scoped_allocator ; - -run unordered/serialization_tests.cpp - : - : - : BOOST_UNORDERED_FOA_TESTS - off # Boost.Serialization headers are not warning-free - norecover:no # boost::archive::xml_oarchive does not pass UBSAN - msvc:/bigobj - gcc:on - gcc:space - clang:on - clang:space - /boost/serialization//boost_serialization/off - /boost/container//boost_container/off - gcc,windows:no # Boost.Atomic no longer supports MinGW - : foa_serialization_tests ; - -local FOA_EXCEPTION_TESTS = - constructor_exception_tests - copy_exception_tests - assign_exception_tests - move_assign_exception_tests - insert_exception_tests - erase_exception_tests - rehash_exception_tests - swap_exception_tests - merge_exception_tests -; - -for local test in $(FOA_EXCEPTION_TESTS) -{ - run exception/$(test).cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_$(test) ; -} - -local MMAP_CONTAINERS = - unordered_flat_map - unordered_flat_set - unordered_node_map - unordered_node_set - unordered_map - unordered_set - unordered_multimap - unordered_multiset - concurrent_flat_map - concurrent_flat_set -; - -for local container in $(MMAP_CONTAINERS) -{ - run unordered/mmap_tests.cpp - /boost/filesystem//boost_filesystem - /boost/interprocess//boost_interprocess - /boost/process//boost_process - /boost/uuid//boost_uuid - : : - : BOOST_UNORDERED_FOA_MMAP_MAP_TYPE="boost::$(container)" - off - static - gcc-4.8:no # Boost.Process does not compile - gcc-4.9:no # ditto - cygwin:no - gcc,windows:no # Process on MinGW on Appveyor doesn't compile - : foa_mmap_$(container)_tests ; -} - -alias foa_mmap_tests : foa_mmap_$(MMAP_CONTAINERS)_tests ; - -alias foa_tests : - foa_$(FOA_TESTS) - foa_$(FOA_EXCEPTION_TESTS) - foa_link_test - foa_scoped_allocator - foa_serialization_tests - foa_mmap_tests -; - -local CFOA_TESTS = - erase_tests - try_emplace_tests - emplace_tests - extract_insert_tests - constructor_tests - assign_tests - clear_tests - swap_tests - merge_tests - rehash_tests - equality_tests - fwd_tests - exception_insert_tests - exception_erase_tests - exception_constructor_tests - exception_assign_tests - exception_merge_tests - rw_spinlock_test - rw_spinlock_test2 - rw_spinlock_test3 - rw_spinlock_test4 - rw_spinlock_test5 - rw_spinlock_test6 - rw_spinlock_test7 - rw_spinlock_test8 - reentrancy_check_test - explicit_alloc_ctor_tests - pmr_allocator_tests - stats_tests - node_handle_allocator_tests - incomplete_tests -; - -for local test in $(CFOA_TESTS) -{ - run cfoa/$(test).cpp - : requirements multi - : target-name cfoa_$(test) - ; -} - -run cfoa/insert_tests.cpp - : - : - : $(CPP11) multi - msvc:/bigobj - gcc:on - gcc:space - clang:on - clang:space - : cfoa_insert_tests ; - -run cfoa/visit_tests.cpp - : - : - : $(CPP11) multi - msvc:/bigobj - gcc:on - gcc:space - clang:on - clang:space - : cfoa_visit_tests ; - -run cfoa/serialization_tests.cpp - : - : - : $(CPP11) multi - off # Boost.Serialization headers are not warning-free - norecover:no # boost::archive::xml_oarchive does not pass UBSAN - msvc:/bigobj - gcc:on - gcc:space - clang:on - clang:space - /boost/serialization//boost_serialization/off - /boost/container//boost_container/off - gcc,windows:no # Boost.Atomic no longer supports MinGW - gcc,norecover:no # TSAN does not support atomic_thread_fence - clang,norecover:no # idem - : cfoa_serialization_tests ; - -rule make_cfoa_interprocess_concurrency_tests ( name : defines ? ) -{ - run cfoa/interprocess_concurrency_tests.cpp : : - : $(defines) - off - static - clang-3.5:no # Boost.Process does not compile - clang-3.6:no # idem - clang-3.7:no # idem - clang-3.8:no # idem - gcc-4.8:no # idem - gcc-4.9:no # idem - cygwin:no - gcc,windows:no # Process on MinGW on Appveyor doesn't compile - /boost/filesystem//boost_filesystem - /boost/interprocess//boost_interprocess - /boost/process//boost_process - /boost/uuid//boost_uuid - : $(name) ; -} - -make_cfoa_interprocess_concurrency_tests cfoa_interproc_conc_tests ; - -make_cfoa_interprocess_concurrency_tests cfoa_interproc_conc_tests_stats - : BOOST_UNORDERED_ENABLE_STATS ; - -alias cfoa_tests : - cfoa_$(CFOA_TESTS) - cfoa_insert_tests - cfoa_visit_tests - cfoa_serialization_tests - cfoa_interproc_conc_tests - cfoa_interproc_conc_tests_stats ; diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index da0b02712..ed0ca9823 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -5,6 +5,7 @@ // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +#include #include "../helpers/unordered.hpp" #include "../helpers/metafunctions.hpp" @@ -801,6 +802,7 @@ namespace rehash_tests { test_multimap_monotonic; // clang-format off +#if 0 UNORDERED_TEST(rehash_empty_test1, ((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))) UNORDERED_TEST(rehash_empty_test2, @@ -837,6 +839,7 @@ namespace rehash_tests { (test_multiset_tracking)(test_multimap_tracking))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(test_gh348_1,((0))) +#endif UNORDERED_TEST(test_gh348_2,((0))) // clang-format on #endif From 9569262ea46148db71b70624dd20d30ef196f85f Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:14:49 +0200 Subject: [PATCH 02/14] fixed Jamfile.v2 --- test/Jamfile.v2 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 6d3a698e7..f1fc6f2af 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -45,6 +45,11 @@ local FCA_TESTS = reserve_tests ; +for local test in $(FCA_TESTS) +{ + run unordered/$(test).cpp ; +} + alias fca_tests : $(FCA_TESTS) From 8d5e1c7fcd2a803576785d8c7def79f6d46cab11 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:18:57 +0200 Subject: [PATCH 03/14] fixed Jamfile.v2 --- test/Jamfile.v2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f1fc6f2af..3d80d9e0c 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -42,7 +42,7 @@ path-constant BOOST_UNORDERED_TEST_DIR : . ; local FCA_TESTS = - reserve_tests + rehash_tests ; for local test in $(FCA_TESTS) From 987e3e617920b56da226f41695cbc92fecae883a Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:37:12 +0200 Subject: [PATCH 04/14] added more instrumentation --- include/boost/unordered/detail/implementation.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index c632a1743..6fbd1646a 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -955,6 +955,7 @@ namespace boost { inline std::size_t double_to_size(double f) { std::cout << " double_to_size\n"; + std::cout << " f: " << f << "\n"; auto ret = f >= static_cast( (std::numeric_limits::max)()) ? (std::numeric_limits::max)() From e23aaa90ce09defb589aaa19c59de0baba560917 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:46:26 +0200 Subject: [PATCH 05/14] added more instrumentation --- include/boost/unordered/detail/implementation.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 6fbd1646a..da18f377b 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -956,6 +956,7 @@ namespace boost { { std::cout << " double_to_size\n"; std::cout << " f: " << f << "\n"; + std::cout << " double(size_t_max): " << static_cast((std::numeric_limits::max)()) << "\n"; auto ret = f >= static_cast( (std::numeric_limits::max)()) ? (std::numeric_limits::max)() From d2c8d7d6966875ef2425302fbbf201aa69757594 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 12:55:01 +0200 Subject: [PATCH 06/14] added more instrumentation --- include/boost/unordered/detail/implementation.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index da18f377b..bfd0923ae 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -957,6 +957,9 @@ namespace boost { std::cout << " double_to_size\n"; std::cout << " f: " << f << "\n"; std::cout << " double(size_t_max): " << static_cast((std::numeric_limits::max)()) << "\n"; + std::cout << " comparison: " << (f >= static_cast((std::numeric_limits::max)())) << "\n"; + std::cout << " 1st branch: " << (std::numeric_limits::max)() << "\n"; + std::cout << " 2nd branch: " << static_cast(f) << "\n"; auto ret = f >= static_cast( (std::numeric_limits::max)()) ? (std::numeric_limits::max)() From 03c510b0843517899750b269e3cfc3bc519b3979 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 13:06:26 +0200 Subject: [PATCH 07/14] Clang 3.8 now passes --> codegen issue, retired instrumentation --- include/boost/unordered/detail/implementation.hpp | 15 +-------------- test/unordered/rehash_tests.cpp | 1 - 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index bfd0923ae..23a5776bc 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,18 +954,10 @@ namespace boost { inline std::size_t double_to_size(double f) { - std::cout << " double_to_size\n"; - std::cout << " f: " << f << "\n"; - std::cout << " double(size_t_max): " << static_cast((std::numeric_limits::max)()) << "\n"; - std::cout << " comparison: " << (f >= static_cast((std::numeric_limits::max)())) << "\n"; - std::cout << " 1st branch: " << (std::numeric_limits::max)() << "\n"; - std::cout << " 2nd branch: " << static_cast(f) << "\n"; - auto ret = f >= static_cast( + return f >= static_cast( (std::numeric_limits::max)()) ? (std::numeric_limits::max)() : static_cast(f); - std::cout << " ret: " << ret << "\n"; - return ret; } ////////////////////////////////////////////////////////////////////////// @@ -1789,10 +1781,8 @@ namespace boost { static std::size_t min_buckets(std::size_t num_elements, float mlf) { - std::cout << " min_buckets\n"; std::size_t num_buckets = boost::unordered::detail::double_to_size( std::ceil(static_cast(num_elements) / mlf)); - std::cout << " num_buckets: " << num_buckets << "\n"; if (num_buckets == 0 && num_elements > 0) { // mlf == inf num_buckets = 1; @@ -2714,10 +2704,7 @@ namespace boost { template inline void table::reserve(std::size_t num_elements) { - std::cout << "reserve\n"; - std::cout << " num_elements: " << num_elements << "\n"; std::size_t num_buckets = min_buckets(num_elements, mlf_); - std::cout << " num_buckets: " << num_buckets << "\n"; this->rehash(num_buckets); } diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index ed0ca9823..d6902ec6e 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -5,7 +5,6 @@ // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -#include #include "../helpers/unordered.hpp" #include "../helpers/metafunctions.hpp" From 33454776269c2eed84f1931673cd7ae7eadefa38 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 13:20:00 +0200 Subject: [PATCH 08/14] tried replacing ternary operator with if/else --- include/boost/unordered/detail/implementation.hpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 23a5776bc..cecbf1f60 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,10 +954,12 @@ namespace boost { inline std::size_t double_to_size(double f) { - return f >= static_cast( - (std::numeric_limits::max)()) - ? (std::numeric_limits::max)() - : static_cast(f); + if(static_cast((std::numeric_limits::max)())) { + return (std::numeric_limits::max)(); + } + else{ + return static_cast(f); + } } ////////////////////////////////////////////////////////////////////////// From 48aead427f1c00deeeaded9dde5a8af5027a1e02 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 13:27:52 +0200 Subject: [PATCH 09/14] fixed fix --- include/boost/unordered/detail/implementation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index cecbf1f60..b55c22d0f 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,7 +954,7 @@ namespace boost { inline std::size_t double_to_size(double f) { - if(static_cast((std::numeric_limits::max)())) { + if(f >= static_cast((std::numeric_limits::max)())) { return (std::numeric_limits::max)(); } else{ From 9a7d0c9872c0b5e0d4b4795b30d578eba9665b0c Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 13:34:18 +0200 Subject: [PATCH 10/14] tried another workaround --- include/boost/unordered/detail/implementation.hpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index b55c22d0f..e64487c57 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,12 +954,10 @@ namespace boost { inline std::size_t double_to_size(double f) { - if(f >= static_cast((std::numeric_limits::max)())) { - return (std::numeric_limits::max)(); - } - else{ - return static_cast(f); - } + static constexpr double double_size_t_max = + static_cast((std::numeric_limits::max)()); + return f >= double_size_t_max? + (std::numeric_limits::max)(): static_cast(f); } ////////////////////////////////////////////////////////////////////////// From 67531be67b533b316128c2413fb0386fe34b342e Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 13:42:39 +0200 Subject: [PATCH 11/14] tried another workaround --- include/boost/unordered/detail/implementation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index e64487c57..492376503 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,7 +954,7 @@ namespace boost { inline std::size_t double_to_size(double f) { - static constexpr double double_size_t_max = + const double double_size_t_max = static_cast((std::numeric_limits::max)()); return f >= double_size_t_max? (std::numeric_limits::max)(): static_cast(f); From 97247548eb3f0719a965afc44d261b9fbcab28c5 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 17:00:48 +0200 Subject: [PATCH 12/14] tried another workaround --- include/boost/unordered/detail/implementation.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 492376503..51b086474 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -954,7 +954,7 @@ namespace boost { inline std::size_t double_to_size(double f) { - const double double_size_t_max = + const volatile double double_size_t_max = static_cast((std::numeric_limits::max)()); return f >= double_size_t_max? (std::numeric_limits::max)(): static_cast(f); From 85ebff82078e4dd619a944cea7e3b3fcf6011767 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 17:12:55 +0200 Subject: [PATCH 13/14] conditionally applied workaround to Clang < 3.9 --- include/boost/unordered/detail/implementation.hpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index 51b086474..b219d49d8 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -24,6 +24,7 @@ #include #include +#include #include #include #include @@ -954,7 +955,10 @@ namespace boost { inline std::size_t double_to_size(double f) { - const volatile double double_size_t_max = +#if BOOST_WORKAROUND(BOOST_CLANG_VERSION, < 30900) + volatile +#endif + const double double_size_t_max = static_cast((std::numeric_limits::max)()); return f >= double_size_t_max? (std::numeric_limits::max)(): static_cast(f); From 4e484b58f0464a5f8aab942627c245a956773363 Mon Sep 17 00:00:00 2001 From: joaquintides Date: Fri, 29 May 2026 17:23:52 +0200 Subject: [PATCH 14/14] added link to GitHub PR, reverted research traces --- .../boost/unordered/detail/implementation.hpp | 1 + test/Jamfile.v2 | 393 +++++++++++++++++- test/unordered/rehash_tests.cpp | 6 +- 3 files changed, 395 insertions(+), 5 deletions(-) diff --git a/include/boost/unordered/detail/implementation.hpp b/include/boost/unordered/detail/implementation.hpp index b219d49d8..b6ce49fe5 100644 --- a/include/boost/unordered/detail/implementation.hpp +++ b/include/boost/unordered/detail/implementation.hpp @@ -956,6 +956,7 @@ namespace boost { inline std::size_t double_to_size(double f) { #if BOOST_WORKAROUND(BOOST_CLANG_VERSION, < 30900) + // https://github.com/boostorg/unordered/pull/354 volatile #endif const double double_size_t_max = diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 3d80d9e0c..31265e458 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -40,18 +40,409 @@ project path-constant BOOST_UNORDERED_TEST_DIR : . ; +run quick.cpp ; + +compile debuggability/visualization_tests.cpp + : cygwin:_XOPEN_SOURCE=600 + ; + +compile unordered/self_include_tests_obj.cpp + : BOOST_UNORDERED_HEADER="boost/unordered_map.hpp" + : tl_unordered_map_hpp ; + +compile unordered/self_include_tests_obj.cpp + : BOOST_UNORDERED_HEADER="boost/unordered_set.hpp" + : tl_unordered_set_hpp ; + +local include_root = [ path.make $(TOP)/../include ] ; +local headers = [ path.glob-tree $(include_root)/boost/unordered : *.hpp ] ; + +local paths ; +local sanitized_paths ; + +for local header in $(headers) +{ + local path = [ path.relative-to $(include_root) $(header) ] ; + + local sanitized = [ path.relative-to "$(include_root)/boost/unordered" $(header) ] ; + sanitized = [ regex.replace $(sanitized) "[/.\\]" "_" ] ; + + paths += $(path) ; + sanitized_paths += $(sanitized) ; + + compile unordered/self_include_tests_obj.cpp + : BOOST_UNORDERED_HEADER="$(path)" : $(sanitized) ; +} + +alias include_tests + : tl_unordered_map_hpp + tl_unordered_set_hpp + $(sanitized_paths) ; local FCA_TESTS = + allocator_traits + assign_tests + at_tests + bucket_tests + compile_map + compile_set + constructor_tests + contains_tests + copy_tests + deduction_tests + emplace_smf_tests + emplace_tests + equality_tests + equivalent_keys_tests + erase_equiv_tests + erase_if + erase_tests + explicit_alloc_ctor_tests + extract_tests + find_tests + fwd_map_test + fwd_set_test + incomplete_test + insert_hint_tests + insert_stable_tests + insert_tests + load_factor_tests + merge_tests + minimal_allocator + move_tests + narrow_cast_tests + node_handle_tests + node_handle_allocator_tests + noexcept_tests + post_move_tests + prime_fmod_tests rehash_tests + reserve_tests + scary_tests + scoped_allocator + simple_tests + swap_tests + transparent_tests + unnecessary_copy_tests + fancy_pointer_noleak + pmr_allocator_tests ; for local test in $(FCA_TESTS) { - run unordered/$(test).cpp ; + if $(test) = "erase_tests" { + run unordered/$(test).cpp : : : BOOST_UNORDERED_SUPPRESS_DEPRECATED ; + } else if $(test) = "scoped_allocator" { + run unordered/$(test).cpp : : : msvc-14.0:no ; + } else { + run unordered/$(test).cpp ; + } } +run unordered/link_test_1.cpp unordered/link_test_2.cpp : : : : link_test ; + +run unordered/serialization_tests.cpp + : $(BOOST_UNORDERED_TEST_DIR) + : + : BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0 + off # Boost.Serialization headers are not warning-free + norecover:no # boost::archive::xml_oarchive does not pass UBSAN + msvc:_CRT_SECURE_NO_WARNINGS + msvc:/bigobj + gcc:on + gcc:space + clang:on + clang:space + /boost/serialization//boost_serialization/off + /boost/container//boost_container/off + gcc,windows:no ; # Boost.Atomic no longer supports MinGW + +compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MAP : insert_node_type_fail_map ; +compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MULTIMAP : insert_node_type_fail_multimap ; +compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_SET : insert_node_type_fail_set ; +compile-fail unordered/insert_node_type_fail.cpp : UNORDERED_TEST_MULTISET : insert_node_type_fail_multiset ; +compile unordered/explicit_instantiation_tests.cpp : : fca_explicit_instantiation_tests ; +compile unordered/explicit_instantiation_tests.cpp : BOOST_UNORDERED_FOA_TESTS : foa_explicit_instantiation_tests ; +compile cfoa/explicit_instantiation_tests.cpp : : cfoa_explicit_instantiation_tests ; + +compile unordered/conversion_operator_tests.cpp : BOOST_UNORDERED_FOA_TESTS : foa_conversion_operator_tests ; +compile cfoa/conversion_operator_tests.cpp : : cfoa_conversion_operator_tests ; + +local FCA_EXCEPTION_TESTS = + constructor_exception_tests + copy_exception_tests + assign_exception_tests + move_assign_exception_tests + insert_exception_tests + erase_exception_tests + rehash_exception_tests + merge_exception_tests + less_tests + swap_exception_tests +; + +for local test in $(FCA_EXCEPTION_TESTS) +{ + if $(test) = "swap_exception_tests" { + run exception/$(test).cpp : : : BOOST_UNORDERED_SWAP_METHOD=2 ; + } else { + run exception/$(test).cpp ; + } +} + +alias fca_exception_tests : $(FCA_EXCEPTION_TESTS) ; alias fca_tests : $(FCA_TESTS) + $(FCA_EXCEPTION_TESTS) + link_test + insert_node_type_fail_map + insert_node_type_fail_multimap + insert_node_type_fail_set + insert_node_type_fail_multiset + serialization_tests +; + +local FOA_TESTS = + fwd_set_test + fwd_map_test + compile_set + compile_map + noexcept_tests + incomplete_test + simple_tests + equivalent_keys_tests + constructor_tests + copy_tests + move_tests + post_move_tests + assign_tests + insert_tests + insert_hint_tests + emplace_smf_tests + emplace_tests + erase_tests + explicit_alloc_ctor_tests + merge_tests + find_tests + at_tests + load_factor_tests + rehash_tests + equality_tests + swap_tests + transparent_tests + reserve_tests + contains_tests + erase_if + scary_tests + init_type_insert_tests + max_load_tests + extract_tests + node_handle_tests + uses_allocator + hash_is_avalanching_test + fancy_pointer_noleak + pmr_allocator_tests + pull_tests + stats_tests + node_handle_allocator_tests +; + +for local test in $(FOA_TESTS) +{ + run unordered/$(test).cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_$(test) ; +} + +run unordered/link_test_1.cpp unordered/link_test_2.cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_link_test ; +run unordered/scoped_allocator.cpp : : : msvc-14.0:no BOOST_UNORDERED_FOA_TESTS : foa_scoped_allocator ; + +run unordered/serialization_tests.cpp + : + : + : BOOST_UNORDERED_FOA_TESTS + off # Boost.Serialization headers are not warning-free + norecover:no # boost::archive::xml_oarchive does not pass UBSAN + msvc:/bigobj + gcc:on + gcc:space + clang:on + clang:space + /boost/serialization//boost_serialization/off + /boost/container//boost_container/off + gcc,windows:no # Boost.Atomic no longer supports MinGW + : foa_serialization_tests ; + +local FOA_EXCEPTION_TESTS = + constructor_exception_tests + copy_exception_tests + assign_exception_tests + move_assign_exception_tests + insert_exception_tests + erase_exception_tests + rehash_exception_tests + swap_exception_tests + merge_exception_tests +; + +for local test in $(FOA_EXCEPTION_TESTS) +{ + run exception/$(test).cpp : : : BOOST_UNORDERED_FOA_TESTS : foa_$(test) ; +} + +local MMAP_CONTAINERS = + unordered_flat_map + unordered_flat_set + unordered_node_map + unordered_node_set + unordered_map + unordered_set + unordered_multimap + unordered_multiset + concurrent_flat_map + concurrent_flat_set +; + +for local container in $(MMAP_CONTAINERS) +{ + run unordered/mmap_tests.cpp + /boost/filesystem//boost_filesystem + /boost/interprocess//boost_interprocess + /boost/process//boost_process + /boost/uuid//boost_uuid + : : + : BOOST_UNORDERED_FOA_MMAP_MAP_TYPE="boost::$(container)" + off + static + gcc-4.8:no # Boost.Process does not compile + gcc-4.9:no # ditto + cygwin:no + gcc,windows:no # Process on MinGW on Appveyor doesn't compile + : foa_mmap_$(container)_tests ; +} + +alias foa_mmap_tests : foa_mmap_$(MMAP_CONTAINERS)_tests ; + +alias foa_tests : + foa_$(FOA_TESTS) + foa_$(FOA_EXCEPTION_TESTS) + foa_link_test + foa_scoped_allocator + foa_serialization_tests + foa_mmap_tests ; +local CFOA_TESTS = + erase_tests + try_emplace_tests + emplace_tests + extract_insert_tests + constructor_tests + assign_tests + clear_tests + swap_tests + merge_tests + rehash_tests + equality_tests + fwd_tests + exception_insert_tests + exception_erase_tests + exception_constructor_tests + exception_assign_tests + exception_merge_tests + rw_spinlock_test + rw_spinlock_test2 + rw_spinlock_test3 + rw_spinlock_test4 + rw_spinlock_test5 + rw_spinlock_test6 + rw_spinlock_test7 + rw_spinlock_test8 + reentrancy_check_test + explicit_alloc_ctor_tests + pmr_allocator_tests + stats_tests + node_handle_allocator_tests + incomplete_tests +; + +for local test in $(CFOA_TESTS) +{ + run cfoa/$(test).cpp + : requirements multi + : target-name cfoa_$(test) + ; +} + +run cfoa/insert_tests.cpp + : + : + : $(CPP11) multi + msvc:/bigobj + gcc:on + gcc:space + clang:on + clang:space + : cfoa_insert_tests ; + +run cfoa/visit_tests.cpp + : + : + : $(CPP11) multi + msvc:/bigobj + gcc:on + gcc:space + clang:on + clang:space + : cfoa_visit_tests ; + +run cfoa/serialization_tests.cpp + : + : + : $(CPP11) multi + off # Boost.Serialization headers are not warning-free + norecover:no # boost::archive::xml_oarchive does not pass UBSAN + msvc:/bigobj + gcc:on + gcc:space + clang:on + clang:space + /boost/serialization//boost_serialization/off + /boost/container//boost_container/off + gcc,windows:no # Boost.Atomic no longer supports MinGW + gcc,norecover:no # TSAN does not support atomic_thread_fence + clang,norecover:no # idem + : cfoa_serialization_tests ; + +rule make_cfoa_interprocess_concurrency_tests ( name : defines ? ) +{ + run cfoa/interprocess_concurrency_tests.cpp : : + : $(defines) + off + static + clang-3.5:no # Boost.Process does not compile + clang-3.6:no # idem + clang-3.7:no # idem + clang-3.8:no # idem + gcc-4.8:no # idem + gcc-4.9:no # idem + cygwin:no + gcc,windows:no # Process on MinGW on Appveyor doesn't compile + /boost/filesystem//boost_filesystem + /boost/interprocess//boost_interprocess + /boost/process//boost_process + /boost/uuid//boost_uuid + : $(name) ; +} + +make_cfoa_interprocess_concurrency_tests cfoa_interproc_conc_tests ; + +make_cfoa_interprocess_concurrency_tests cfoa_interproc_conc_tests_stats + : BOOST_UNORDERED_ENABLE_STATS ; + +alias cfoa_tests : + cfoa_$(CFOA_TESTS) + cfoa_insert_tests + cfoa_visit_tests + cfoa_serialization_tests + cfoa_interproc_conc_tests + cfoa_interproc_conc_tests_stats ; diff --git a/test/unordered/rehash_tests.cpp b/test/unordered/rehash_tests.cpp index d6902ec6e..e96db4d68 100644 --- a/test/unordered/rehash_tests.cpp +++ b/test/unordered/rehash_tests.cpp @@ -801,7 +801,6 @@ namespace rehash_tests { test_multimap_monotonic; // clang-format off -#if 0 UNORDERED_TEST(rehash_empty_test1, ((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))) UNORDERED_TEST(rehash_empty_test2, @@ -837,9 +836,8 @@ namespace rehash_tests { (test_multiset_ptr)(int_multimap_ptr) (test_multiset_tracking)(test_multimap_tracking))( (default_generator)(generate_collisions)(limited_range))) - UNORDERED_TEST(test_gh348_1,((0))) -#endif - UNORDERED_TEST(test_gh348_2,((0))) + UNORDERED_TEST(test_gh348_1, ((0))) + UNORDERED_TEST(test_gh348_2, ((0))) // clang-format on #endif } // namespace rehash_tests