Skip to content

Commit 53d95bc

Browse files
jlowealliepiper
authored andcommitted
Evaluate CUDA_CUB_RET_IF_FAIL macro argument only once
1 parent 8ced494 commit 53d95bc

File tree

1 file changed

+4
-1
lines changed
  • thrust/system/cuda/detail/core

1 file changed

+4
-1
lines changed

thrust/system/cuda/detail/core/util.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,10 @@ namespace core {
652652
}
653653

654654
#define CUDA_CUB_RET_IF_FAIL(e) \
655-
if (cub::Debug((e), __FILE__, __LINE__)) return e;
655+
do { \
656+
auto const error = (e); \
657+
if (cub::Debug(error, __FILE__, __LINE__)) return error; \
658+
} while(0);
656659

657660
// uninitialized
658661
// -------

0 commit comments

Comments
 (0)