From 1059e018eaf46963229284bd260c3d00b3c4e6bd Mon Sep 17 00:00:00 2001 From: fbusato Date: Wed, 5 Mar 2025 10:54:58 -0800 Subject: [PATCH 1/2] replace sizeof with alignof --- libcudacxx/include/cuda/std/__memory/assume_aligned.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcudacxx/include/cuda/std/__memory/assume_aligned.h b/libcudacxx/include/cuda/std/__memory/assume_aligned.h index 2359fada973..5cd80c5f70d 100644 --- a/libcudacxx/include/cuda/std/__memory/assume_aligned.h +++ b/libcudacxx/include/cuda/std/__memory/assume_aligned.h @@ -34,7 +34,7 @@ template _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr _Tp* assume_aligned(_Tp* __ptr) noexcept { static_assert(_CUDA_VSTD::has_single_bit(_Align), "std::assume_aligned requires the alignment to be a power of 2"); - static_assert(_Align >= sizeof(_Tp), "Alignment must be greater than or equal to the size of the input type"); + static_assert(_Align >= alignof(_Tp), "Alignment must be greater than or equal to the size of the input type"); #if !defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED) return __ptr; #else From a4faccd122a0901fbbce3d165f8f31bc1fe054d0 Mon Sep 17 00:00:00 2001 From: Federico Busato <50413820+fbusato@users.noreply.github.com> Date: Wed, 5 Mar 2025 11:55:56 -0800 Subject: [PATCH 2/2] Update libcudacxx/include/cuda/std/__memory/assume_aligned.h Co-authored-by: Bernhard Manfred Gruber --- libcudacxx/include/cuda/std/__memory/assume_aligned.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libcudacxx/include/cuda/std/__memory/assume_aligned.h b/libcudacxx/include/cuda/std/__memory/assume_aligned.h index 5cd80c5f70d..410019d8db4 100644 --- a/libcudacxx/include/cuda/std/__memory/assume_aligned.h +++ b/libcudacxx/include/cuda/std/__memory/assume_aligned.h @@ -34,7 +34,7 @@ template _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI constexpr _Tp* assume_aligned(_Tp* __ptr) noexcept { static_assert(_CUDA_VSTD::has_single_bit(_Align), "std::assume_aligned requires the alignment to be a power of 2"); - static_assert(_Align >= alignof(_Tp), "Alignment must be greater than or equal to the size of the input type"); + static_assert(_Align >= alignof(_Tp), "Alignment must be greater than or equal to the alignment of the input type"); #if !defined(_CCCL_BUILTIN_IS_CONSTANT_EVALUATED) return __ptr; #else