]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC r354255:
authordim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 10 Nov 2019 17:33:10 +0000 (17:33 +0000)
committerdim <dim@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Sun, 10 Nov 2019 17:33:10 +0000 (17:33 +0000)
commitc95ee20e10dae9ef627d80bd0d52c7ed12ccb060
treec338641e2cbc3d39b7742184881746be9ee6e936
parentc5a8650ca50d262a02b4c6e27f4e4464cedfd3d2
MFC r354255:

Add __isnan()/__isnanf() aliases for compatibility with glibc and CUDA

Even though clang comes with a number of internal CUDA wrapper headers,
compiling sample CUDA programs will result in errors similar to:

In file included from <built-in>:1:
In file included from /usr/lib/clang/9.0.0/include/__clang_cuda_runtime_wrapper.h:204:
/usr/home/arr/cuda/var/cuda-repo-10-0-local-10.0.130-410.48/usr/local/cuda-10.0//include/crt/math_functions.hpp:2910:7: error: no matching function for call to '__isnan'
  if (__isnan(a)) {
      ^~~~~~~
/usr/lib/clang/9.0.0/include/__clang_cuda_device_functions.h:460:16: note: candidate function not viable: call to __device__ function from __host__ function
__DEVICE__ int __isnan(double __a) { return __nv_isnand(__a); }
               ^

CUDA expects __isnan() and __isnanf() declarations to be available,
which are glibc specific extensions, equivalent to the regular isnan()
and isnanf().

To provide these, define __isnan() and __isnanf() as aliases of the
already existing static inline functions __inline_isnan() and
__inline_isnanf() from math.h.

Reported by: arrowd
PR: 241550

git-svn-id: svn://svn.freebsd.org/base/stable/10@354596 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
lib/libc/gen/isnan.c
lib/msun/src/math.h
lib/msun/src/s_isnan.c