diff --git a/cub/test/catch2_test_launch_helper.h b/cub/test/catch2_test_launch_helper.h index c111b4f9700..46708da774f 100644 --- a/cub/test/catch2_test_launch_helper.h +++ b/cub/test/catch2_test_launch_helper.h @@ -188,9 +188,11 @@ void launch(ActionT action, Args... args) REQUIRE(temp_storage_bytes > 0); // required by API contract - c2h::device_vector temp_storage(temp_storage_bytes, thrust::no_init); + // randomly offset the temporary storage address by one byte + const int offset = GENERATE(take(1, random(0, 1))); + c2h::device_vector temp_storage(temp_storage_bytes + offset, thrust::no_init); - error = action(thrust::raw_pointer_cast(temp_storage.data()), temp_storage_bytes, args...); + error = action(thrust::raw_pointer_cast(temp_storage.data()) + offset, temp_storage_bytes, args...); REQUIRE(cudaSuccess == cudaPeekAtLastError()); REQUIRE(cudaSuccess == cudaDeviceSynchronize()); REQUIRE(cudaSuccess == error);