Merged
Conversation
We were not resetting the `vector::m_size` member after destroying the old storage, only `vector::m_storage::m_size`. Then in `range_assign` we would call `m_storage.destroy(begin(), end());` but `end()` takes into account `vector::m_size` and not `vector::m_storage::m_size`. Consequently we would try to delete the old elements again, even if the storage was already deallocated, passing a `nullptr` to `destroy_at` This started to fail because with the rework of `allocator_traits` in another PR we are actually checking in `cuda::std::__destroy_at` whether the passed pointer is valid.
elstehle
approved these changes
Jan 23, 2026
davebayer
approved these changes
Jan 23, 2026
bernhardmgruber
requested changes
Jan 23, 2026
Comment on lines
169
to
175
| m_storage.propagate_allocator(v.m_storage); | ||
| if constexpr (thrust::detail::allocator_traits<Alloc>::propagate_on_container_copy_assignment::value) | ||
| { | ||
| if (m_allocator != other.m_allocator) | ||
| { | ||
| m_size = 0; | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Since m_storage.propagate_allocator changes this->m_allocator, we need to move this check before it.
88600bf to
0135e55
Compare
0135e55 to
679ba42
Compare
bernhardmgruber
approved these changes
Jan 23, 2026
This comment has been minimized.
This comment has been minimized.
Contributor
🥳 CI Workflow Results🟩 Finished in 4h 53m: Pass: 100%/86 | Total: 3d 00h | Max: 2h 29m | Hits: 73%/125754See results here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We were not resetting the
vector::m_sizemember after destroying the old storage, onlyvector::m_storage::m_size. Then inrange_assignwe would callm_storage.destroy(begin(), end());butend()takes into accountvector::m_sizeand notvector::m_storage::m_size.Consequently we would try to delete the old elements again, even if the storage was already deallocated, passing a
nullptrtodestroy_atThis started to fail because with the rework of
allocator_traitsin another PR we are actually checking incuda::std::__destroy_atwhether the passed pointer is valid.