From 2dee09bd5b070cfcf8dbde6317944e781322b6db Mon Sep 17 00:00:00 2001 From: Philip Salzmann Date: Fri, 4 Oct 2019 10:09:19 +0200 Subject: [PATCH] Fix uninitialized var in hipDeviceGetAttribute (#1497) This fixes the usage of an uninitialized cdattr variable in hipDeviceGetAttribute for the CUDA backend when taking the switch default, as detailed in #1317. Note that the directed_tests/runtimeApi/device/hipGetDeviceAttribute.tst test fails for me, but it already did before applying this patch. Let's see what CI says! [ROCm/clr commit: 11f23bba3981e99a02fd3c0586d9849b7b10b7be] --- projects/clr/hipamd/include/hip/nvcc_detail/hip_runtime_api.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/projects/clr/hipamd/include/hip/nvcc_detail/hip_runtime_api.h b/projects/clr/hipamd/include/hip/nvcc_detail/hip_runtime_api.h index b788aa5cdc..97551d15d4 100644 --- a/projects/clr/hipamd/include/hip/nvcc_detail/hip_runtime_api.h +++ b/projects/clr/hipamd/include/hip/nvcc_detail/hip_runtime_api.h @@ -992,8 +992,7 @@ inline static hipError_t hipDeviceGetAttribute(int* pi, hipDeviceAttribute_t att cdattr = cudaDevAttrEccEnabled; break; default: - cerror = cudaErrorInvalidValue; - break; + return hipCUDAErrorTohipError(cudaErrorInvalidValue); } cerror = cudaDeviceGetAttribute(pi, cdattr, device);