Offloading app build error with Trunk

Hi,
I am getting a build error:

In file included from /gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/…/…/…/…/include/c++/7.2.0/cstdlib:77:
/gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/…/…/…/…/include/c++/7.2.0/bits/std_abs.h:70:3: error: declaration conflicts with target of using declaration already in scope
abs(double __x)
^
/p/scratch/cpcp0/pcp0151/opt/clang/201912160138/lib/clang/10.0.0/include/__clang_cuda_cmath.h:57:25: note: target of using declaration
DEVICE const double abs(const double __x) { return ::fabs((double)__x); }
^
/gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/…/…/…/…/include/c++/7.2.0/bits/std_abs.h:52:11: note: using declaration
using ::abs;
^
/gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/…/…/…/…/include/c++/7.2.0/bits/std_abs.h:74:3: error: declaration conflicts with target of using declaration already in scope
abs(float __x)
^
/p/scratch/cpcp0/pcp0151/opt/clang/201912160138/lib/clang/10.0.0/include/__clang_cuda_cmath.h:56:24: note: target of using declaration
DEVICE const float abs(const float __x) { return ::fabsf((float)__x); }
^
/gpfs/software/opt/gcc/7.2.0/lib/gcc/powerpc64le-unknown-linux-gnu/7.2.0/…/…/…/…/include/c++/7.2.0/bits/std_abs.h:52:11: note: using declaration
using ::abs;
^
/p/project/cpcp0/pcp0151/projects/nest-simulator/librandom/binomial_randomdev.cpp:233:34: warning: implicit conversion from ‘long’ to ‘double’ changes value from 9223372036854775807 to 9223372036854775808 [-Wimplicit-int-float-conversion]
static_cast< long >( 0.998 * std::numeric_limits< long >::max() );
~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 2 errors generated.
make[2]: *** [librandom/CMakeFiles/random.dir/binomial_randomdev.cpp.o] Error 1
make[1]: *** [librandom/CMakeFiles/random.dir/all] Error 2
make: *** [all] Error 2

Although I have this hunk:

$ git diff
diff --git a/clang/lib/Headers/__clang_cuda_math_forward_declares.h b/clang/lib/Headers/__clang_cuda_math_f
index 0afe4db…46b95db 100644
— a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
+++ b/clang/lib/Headers/__clang_cuda_math_forward_declares.h
@@ -47,8 +47,8 @@ DEVICE float abs(float);
// TODO: Once variant is supported the additional functions will have
// to be removed.
#if defined(_OPENMP) && defined(__cplusplus)
-DEVICE const double abs(const double);
-DEVICE const float abs(const float);
+//DEVICE const double abs(const double);
+//DEVICE const float abs(const float);
#endif
DEVICE int abs(int) __NOEXCEPT;
DEVICE double acos(double);

, as Alexey suggested.

Following up on my post:

Applying below to current Trunk as of this writing:
$ git diff
diff --git a/clang/lib/Headers/__clang_cuda_cmath.h b/clang/lib/Headers/_clang
index 834a2e3…fb17660 100644
— a/clang/lib/Headers/__clang_cuda_cmath.h
+++ b/clang/lib/Headers/__clang_cuda_cmath.h
@@ -53,8 +53,8 @@ DEVICE double abs(double __x) { return ::fabs(__x); }
#endif
// TODO: remove once variat is supported.
#if defined(_OPENMP) && defined(__cplusplus)
-DEVICE const float abs(const float __x) { return ::fabsf((float)__x); }
-DEVICE const double abs(const double __x) { return ::fabs((double)__x); }
+//DEVICE const float abs(const float __x) { return ::fabsf((float)__x); }
+//DEVICE const double abs(const double __x) { return ::fabs((double)__x); }
#endif
DEVICE float acos(float __x) { return ::acosf(__x); }
DEVICE float asin(float __x) { return ::asinf(__x); }
diff --git a/clang/lib/Headers/__clang_cuda_math_forward_declares.h b/clang/lib/
index 0afe4db…46b95db 100644
— a/clang/lib/Headers/__clang_cuda_math_forward_declares.h
+++ b/clang/lib/Headers/__clang_cuda_math_forward_declares.h
@@ -47,8 +47,8 @@ DEVICE float abs(float);
// TODO: Once variant is supported the additional functions will have
// to be removed.
#if defined(_OPENMP) && defined(__cplusplus)
-DEVICE const double abs(const double);
-DEVICE const float abs(const float);
+//DEVICE const double abs(const double);
+//DEVICE const float abs(const float);
#endif
DEVICE int abs(int) __NOEXCEPT;
DEVICE double acos(double);

now my app builds again on POWER8.

Experts,
If you guys can come up a work-around patch, would you merge it in trunk so
we don’t need to make local changes?

Thanks,

Hi Itaru,

The real solution to the math stuff is prototyped in D71179.
Unfortunately the discussion, which continued on D71241, got derailed.
Once we finally get it unstuck I will get things in asap, hopefully before the LLVM 10 fork.

Sorry for the wait,
  Johannes