https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127675

            Bug ID: 127675
           Summary: Random failure with debug mode: FAIL:
                    ext/pb_ds/regression/tree_map_rand.cc
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Keywords: testsuite-fail
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

I see occasional failures of this test when run with -D_GLIBCXX_DEBUG. The test
uses a the current time as the seed fo a PRNG, so it's not always reproducible.

Sometimes it fails like this:

****************************/tmp/build14/x86_64-pc-linux-gnu/libstdc++-v3/include/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp:72:
check_size 27 != 21
FAIL: ext/pb_ds/regression/tree_map_rand.cc  -std=gnu++11 execution test

A different failure can be reproduced with a fixed seed:

---
a/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
+++
b/libstdc++-v3/testsuite/util/regression/rand/assoc/rand_regression_test.hpp
@@ -104,7 +104,7 @@ namespace detail
     // Sane defaults.
     size_t n = iter;
     size_t m = keys;
-    size_t sd = twister_rand_gen::get_time_determined_seed();
+    size_t sd = 1790758266;
     double tp = 0.2;
     double ip = 0.6;
     double ep = 0.2;

That fails like so:

*********************************/home/jwakely/gcc/14/include/c++/14.4.1/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp:179:
In function:
    void gnu_pbds::detail::ov_tree_map<Key, Mapped, Cmp_Fn, 
    Node_And_It_Traits, _Alloc>::assert_valid(const char*, int) const [with 
    Key = gnu_pbds::test::basic_type; Mapped = gnu_pbds::test::basic_type; 
    Cmp_Fn = std::less<gnu_pbds::test::basic_type>; Node_And_It_Traits = 
    gnu_pbds::detail::tree_traits<gnu_pbds::test::basic_type, 
    gnu_pbds::test::basic_type, std::less<gnu_pbds::test::basic_type>, 
    gnu_pbds::tree_order_statistics_node_update, gnu_pbds::ov_tree_tag, 
    gnu_cxx::throw_allocator_random<gnu_pbds::test::basic_type> >; _Alloc = 
    gnu_cxx::throw_allocator_random<gnu_pbds::test::basic_type>]

Error: m_a_values == 0 && m_end_it == 0 && m_size == 0 assertion from 
/home/jwakely/gcc/14/include/c++/14.4.1/ext/pb_ds/detail/ov_tree_map_/debug_fn_imps.hpp
:51.
Aborted                    (core dumped) ./a.out



Different seeds give different failures:


*********/home/jwakely/gcc/14/include/c++/14.4.1/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp:72:
check_size 5 != 4
Aborted                    (core dumped) SEED=1790759224 ./a.out


********************/home/jwakely/gcc/14/include/c++/14.4.1/ext/pb_ds/detail/ov_tree_map_/erase_fn_imps.hpp:72:
check_size 20 != 15
Aborted                    (core dumped) SEED=1790759663 ./a.out


************/home/jwakely/gcc/14/include/c++/14.4.1/ext/pb_ds/detail/ov_tree_map_/info_fn_imps.hpp:48:
check_size 14 != 7
Aborted                    (core dumped) SEED=1790759854 ./a.out


Something is broken in this code.

Reply via email to