Skip to content

Commit 71d2c2d

Browse files
philnik777krishna2803
authored andcommitted
[libc++] Fix incorrect down cast in __tree::operator=
This has been introduced by llvm#151304. This problem is diagnosed by UBSan with optimizations enabled. Since we run UBSan only with optimizations disabled currently, this isn't caught in our CI. We should look into enabling UBSan with optimizations enabled to catch these sorts of issues before landing a patch.
1 parent 8fa77af commit 71d2c2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libcxx/include/__tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,7 +1388,7 @@ __tree<_Tp, _Compare, _Allocator>& __tree<_Tp, _Compare, _Allocator>::operator=(
13881388
if (__root())
13891389
__root()->__parent_ = __end_node();
13901390
}
1391-
__begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(static_cast<__node_base_pointer>(__end_node())));
1391+
__begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
13921392
__size_ = __t.size();
13931393

13941394
return *this;

0 commit comments

Comments
 (0)