https://bugs.llvm.org/show_bug.cgi?id=37753
Bug ID: 37753
Summary: std::min and std::max cannot be used in __host__
__device__ functions under C++14
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: CUDA
Assignee: unassignedclangb...@nondot.org
Reporter: j....@gmx.com
CC: llvm-bugs@lists.llvm.org
The following commit does not do the right thing because it makes it impossible
to use the std::min and std::max functions in __host__ __device__ functions
under C++14.
https://github.com/llvm-mirror/clang/commit/
2528a79005f7195f1ede353e21688e5223ac2460#diff-0df73228daf7d086a1a4baf1dc1b092e
Simple repro case:
////////////////////
#include <algorithm>
#include <cstdio>
__host__ __device__
void print_min(int a, int b)
{
printf("min(%d, %d) = %d\n", a, b, std::min(a, b));
}
int main()
{
print_min(1, 2);
return 0;
}
////////////////////
Compilation with nvcc from CUDA 9.2 succeeds: `nvcc -std=c++14
--expt-relaxed-constexpr std_min.cu -o std_min`
clang 7.0.0 (trunk 334304) fails: `clang++ -std=c++14 --cuda-gpu-arch=sm_61
std_min.cu -o std_min`
Actual error message:
std_min.cu:13:45: error: reference to __device__ function 'min<int>' in
__host__ __device__
function
printf("min(%d, %d) = %d\n", a, b, std::min(a, b));
^
/usr/lib/clang/7.0.0/include/cuda_wrappers/algorithm:94:1: note: 'min<int>'
declared here// min(const __T &__a, const __T &__b) {
^
1 error generated when compiling for host.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs