Closed Quuxplusone closed 5 years ago
Bugzilla Link | PR41861 |
Status | RESOLVED FIXED |
Importance | P enhancement |
Reported by | Patrick Atkinson (p.atkinson@bristol.ac.uk) |
Reported on | 2019-05-13 08:26:21 -0700 |
Last modified on | 2019-06-25 09:06:21 -0700 |
Version | unspecified |
Hardware | Other Linux |
CC | a.bataev@hotmail.com, Gheorghe-Teod.Bercea@ibm.com, hfinkel@anl.gov, jdoerfert@anl.gov, llvm-bugs@lists.llvm.org |
Fixed by commit(s) | rL360809 |
Attachments | |
Blocks | |
Blocked by | |
See also |
https://reviews.llvm.org/D61765
fixes clock and abs definitions. Will land soon.
Hi Patrick.
I just committed the fix, can you try again?
Thanks a lot!
Thank you both Johannes and Doru and apologies for not seeing that commit.
I've rebuild Clang and this error has disappeared when using GCC toolchains 4.8
and 6.1.
However, if I instruct Clang to use a GCC toolchain >= 7.0, the error with
'abs' reappears. This seems to be because libstdc++ switched to using a
separate header (bits/std_abs.h) for all 'abs' overloads.
Below is the error I get when using Clang with GCC 7.4 headers:
~ $ clang++ test.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -Xopenmp-
target -march=sm_60 --gcc-toolchain="/projects/bristol/modules/gcc/7.4.0/"
In file included from test.cpp:2:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/iostream:39:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/ostream:38:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/ios:42:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/ios_base.h:41:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/locale_classes.h:40:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/string:52:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/bits/basic_string.h:6361:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/ext/string_conversions.h:41:
In file included from /projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-
linux-gnu/7.4.0/../../../../include/c++/7.4.0/cstdlib:77:
/projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-linux-
gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:70:3: error: declaration
conflicts with target of using declaration already in scope
abs(double __x)
^
/lustre/home/br-
patkinson/modules/x86_64/llvm/install/lib/clang/9.0.0/include/__clang_cuda_math_forward_declares.h:35:19:
note: target of using declaration
__DEVICE__ double abs(double);
^
/projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-linux-
gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:52:11: note: using
declaration
using ::abs;
^
/projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-linux-
gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:74:3: error: declaration
conflicts with target of using declaration already in scope
abs(float __x)
^
/lustre/home/br-
patkinson/modules/x86_64/llvm/install/lib/clang/9.0.0/include/__clang_cuda_math_forward_declares.h:36:18:
note: target of using declaration
__DEVICE__ float abs(float);
^
/projects/bristol/modules/gcc/7.4.0/lib/gcc/x86_64-pc-linux-
gnu/7.4.0/../../../../include/c++/7.4.0/bits/std_abs.h:52:11: note: using
declaration
using ::abs;
^
2 errors generated.
I see that now you get an error with the "double" abs instead of the "long" abs.
Yes, and moving the declarations of "float" and "double" abs in clang_cuda_cmath.h and clang_cuda_math_forward_declares.h to within the "#if !(defined(_OPENMP) && defined(__cplusplus))" block seems to fix the issue for all versions of GCC.
Hi,
I've committed a fix for this.
Can you please try the latest version of the compiler and see if the error has now disappeared.
Thanks a lot,
--Doru
The latest version of the compiler is now working correctly.
Thank you very much Doru.