[libcu++] Move argument bounds helpers to bound file#9276
Conversation
WalkthroughBounds validation logic is consolidated into ChangesBounds Validation Consolidation
Possibly related PRs
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Infer (1.2.0)libcudacxx/test/libcudacxx/cuda/argument/argument_bounds.pass.cpplibcudacxx/test/libcudacxx/cuda/argument/argument_bounds.pass.cpp:11:10: fatal error: 'cuda/_argument' file not found ... [truncated 2200 characters] ... e 13, characters 2-50 Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
libcudacxx/test/libcudacxx/cuda/argument/argument_bounds.pass.cpp (1)
83-88: ⚡ Quick winsuggestion: This still only covers the old same-type intersection cases.
The refactor also moved mixed-type endpoint validation and
remove_cvref-based bounds classification intoargument_bounds.h, but this block only renames the oldintoverlap assertions. Add at least one cross-type case here and one reference-qualified__is_*_bounds_cv_vassertion so the newly moved behavior stays covered.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 361a363a-b9a2-4c45-8ad2-603e1e14b489
📒 Files selected for processing (3)
libcudacxx/include/cuda/__argument/argument.hlibcudacxx/include/cuda/__argument/argument_bounds.hlibcudacxx/test/libcudacxx/cuda/argument/argument_bounds.pass.cpp
💤 Files with no reviewable changes (1)
- libcudacxx/include/cuda/__argument/argument.h
| template <class _To, class _From> | ||
| _CCCL_API constexpr void __assert_in_range([[maybe_unused]] _From __val) noexcept | ||
| { | ||
| if constexpr (::cuda::std::__cccl_is_integer_v<_To> && ::cuda::std::__cccl_is_integer_v<_From>) | ||
| { | ||
| _CCCL_ASSERT(::cuda::std::in_range<_To>(__val), "runtime bound value overflows the element type"); | ||
| } | ||
| } | ||
|
|
||
| template <class _To, class _From> | ||
| [[nodiscard]] _CCCL_API constexpr _To __runtime_bound_cast(_From __val) noexcept | ||
| { | ||
| __assert_in_range<_To>(__val); | ||
| return static_cast<_To>(__val); |
There was a problem hiding this comment.
important: Runtime bounds still narrow silently for non-integer sources.
__runtime_bound_cast only guards integer-to-integer conversions, but __immediate_sequence uses it to store user-supplied runtime bounds as __element_type. A mixed-type case like floating runtime bounds into an integral element type gets truncated before __validate_bounds_intersection runs, so validation happens on different endpoints than the caller passed. Please reject any arithmetic runtime bound that is not exactly representable in _To, not just integer/integer pairs.
🥳 CI Workflow Results🟩 Finished in 1h 05m: Pass: 100%/115 | Total: 18h 40m | Max: 41m 47s | Hits: 98%/343030See results here. |
Put them where they belong