Skip to content

[libc++] Fix incorrect down-cast in __tree #152181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 5, 2025
Merged

Conversation

philnik777
Copy link
Contributor

No description provided.

@philnik777 philnik777 marked this pull request as ready for review August 5, 2025 17:55
@philnik777 philnik777 requested a review from a team as a code owner August 5, 2025 17:55
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 5, 2025
@philnik777 philnik777 merged commit bb3c060 into llvm:main Aug 5, 2025
27 of 36 checks passed
@philnik777 philnik777 deleted the fix_ubsan branch August 5, 2025 17:55
@llvmbot
Copy link
Member

llvmbot commented Aug 5, 2025

@llvm/pr-subscribers-libcxx

Author: Nikolas Klauser (philnik777)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/152181.diff

1 Files Affected:

  • (modified) libcxx/include/__tree (+2-2)
diff --git a/libcxx/include/__tree b/libcxx/include/__tree
index 1b1bb538029da..6ca1a623536f2 100644
--- a/libcxx/include/__tree
+++ b/libcxx/include/__tree
@@ -1445,8 +1445,8 @@ __tree<_Tp, _Compare, _Allocator>::__tree(const __tree& __t)
 
   *__root_ptr()       = static_cast<__node_base_pointer>(__copy_construct_tree(__t.__root()));
   __root()->__parent_ = __end_node();
-  __begin_node_ = static_cast<__end_node_pointer>(std::__tree_min(static_cast<__node_base_pointer>(__end_node())));
-  __size_       = __t.size();
+  __begin_node_       = static_cast<__end_node_pointer>(std::__tree_min(__end_node()->__left_));
+  __size_             = __t.size();
 }
 
 template <class _Tp, class _Compare, class _Allocator>

krishna2803 pushed a commit to krishna2803/llvm-project that referenced this pull request Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants