From 3aed9d3b1954c955eecef3e20f6cf6aac056a77a Mon Sep 17 00:00:00 2001 From: Ben Sander Date: Mon, 28 Mar 2016 05:23:53 -0500 Subject: [PATCH] fix ihipLogStatus so status arg only evaluated once --- include/hcc_detail/hip_hcc.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/hcc_detail/hip_hcc.h b/include/hcc_detail/hip_hcc.h index 38f279a2d3..fecefe27b9 100644 --- a/include/hcc_detail/hip_hcc.h +++ b/include/hcc_detail/hip_hcc.h @@ -160,12 +160,13 @@ class ihipDevice_t; #define ihipLogStatus(_hip_status) \ ({\ - tls_lastHipError = _hip_status;\ + hipError_t _local_hip_status = _hip_status; /*local copy so _hip_status only evaluated once*/ \ + tls_lastHipError = _local_hip_status;\ \ if ((COMPILE_HIP_TRACE_API & 0x2) && HIP_TRACE_API) {\ - fprintf(stderr, " %ship-api: %-30s ret=%2d (%s)>>\n" KNRM, (_hip_status == 0) ? API_COLOR:KRED, __func__, _hip_status, ihipErrorString(_hip_status));\ + fprintf(stderr, " %ship-api: %-30s ret=%2d (%s)>>\n" KNRM, (_local_hip_status == 0) ? API_COLOR:KRED, __func__, _local_hip_status, ihipErrorString(_local_hip_status));\ }\ - _hip_status;\ + _local_hip_status;\ })