[Container] Strange flat_set crash with std::inserter
::operator() (this=0x7fffffffd598, lhs=@0x7ffff61c6320: 61595138, rhs=@0x454000: <error reading variable>) at ../yy/build/boost/boost/container/detail/flat_tree.hpp:66 #2 0x0000000000404367 in boost::container::container_detail::flat_tree
::priv_insert
(this=0x7fffffffd598, p=..., x=@0x7ffff61c6320: 61595138) at ../yy/build/boost/boost/container/flat_set.hpp:688 #5 0x00000000004041bd in boost::container::flat_set
Hi all
It seems that when I copy a sorted but non-unique range of randomly
generated numbers to an output iterator generated from std::inserter to
a boost::flat_set it crashes.
At first I assumed it was because boost::flat_set doesn't have stable
iterators, but it seems that the implementation of std::insert_iterator
does the right thing by reassigning its internal iterator to the result
of the insert operation before incrementing it.
Apologies for not being able to reduce the problem further, but this one
is a little strange, the following code demonstrates the problem (and
some variations that do work) in boost 1.54:
#include (__i=..., __first=..., __last=..., __result=...) at
/usr/include/c++/v1/algorithm:1717
#8 end or from GCC if you prefer:
#0 0x0000000000404bed in std::less<unsigned long>::operator()
(this=0x7fffffffdd10, __x=@0x7ffff62e7320: 61595138, __y=@0x453000:
<error reading variable>) at /usr/include/c++/4.8/bits/stl_function.h:235
#1 0x00000000004047f9 in
boost::container::container_detail::flat_tree_value_compare ::operator() (this=0x7fffffffdd10, lhs=@0x7ffff62e7320: 61595138,
rhs=@0x453000: <error reading variable>) at
../yy/build/boost/boost/container/detail/flat_tree.hpp:66
#2 0x0000000000404389 in
boost::container::container_detail::flat_tree Since my refactoring of the code above, the crash location has changed,
it used to be in:
boost::container::vector::priv_forward_range_insert_at_end_expand_forward
boost/container/vector.hpp:2205
unique_sorted_numbers.size() is 999752. Unfortunately producing a
sequential list of numbers with std::iota and then changing one of them
to the proceeding value didn't repro the problem.
Ben
El 06/09/2013 14:35, Ben Pope escribió:
Hi all
It seems that when I copy a sorted but non-unique range of randomly generated numbers to an output iterator generated from std::inserter to a boost::flat_set it crashes.
At first I assumed it was because boost::flat_set doesn't have stable iterators, but it seems that the implementation of std::insert_iterator does the right thing by reassigning its internal iterator to the result of the insert operation before incrementing it.
Apologies for not being able to reduce the problem further, but this one is a little strange, the following code demonstrates the problem (and some variations that do work) in boost 1.54:
Thanks for the report and the test case. I think tt's a bug in the insertion with hint function in flat_tree. I'll open a ticket for this. Best, Ion
participants (2)
-
Ben Pope
-
Ion Gaztañaga