[llvm-bugs] [Bug 42061] New: Math function conflict when using clang++
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed May 29 08:27:04 PDT 2019
https://bugs.llvm.org/show_bug.cgi?id=42061
Bug ID: 42061
Summary: Math function conflict when using clang++
Product: OpenMP
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Clang Compiler Support
Assignee: unassignedclangbugs at nondot.org
Reporter: csdaley at lbl.gov
CC: llvm-bugs at lists.llvm.org
I encounter a math function conflict issue when using clang++. The conflict
does not happen when using clang. I am using LLVM/Clang/OpenMP commits from
today, 29 May 2019. Please see below
csdaley at cgpu03:~/llvm> cat hello.c
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("hello\n");
return 0;
}
csdaley at cgpu03:~/llvm> clang -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
hello.c -o hello && ./hello
hello
csdaley at cgpu03:~/llvm> clang++ -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
hello.c -o hello && ./hello
clang-9: warning: treating 'c' input as 'c++' when in C++ mode, this behavior
is deprecated [-Wdeprecated]
In file included from hello.c:2:
In file included from /opt/gcc/7.3.0/snos/include/g++/stdlib.h:36:
In file included from /opt/gcc/7.3.0/snos/include/g++/cstdlib:77:
/opt/gcc/7.3.0/snos/include/g++/bits/std_abs.h:70:3: error: declaration
conflicts with target of using declaration already in scope
abs(double __x)
^
/project/projectdirs/m1759/csdaley/software/cgpu/llvm/9.0.0-git_20190529/lib/clang/9.0.0/include/__clang_cuda_math_forward_declares.h:50:25:
note: target of using declaration
__DEVICE__ const double abs(const double);
^
/opt/gcc/7.3.0/snos/include/g++/bits/std_abs.h:52:11: note: using declaration
using ::abs;
^
/opt/gcc/7.3.0/snos/include/g++/bits/std_abs.h:74:3: error: declaration
conflicts with target of using declaration already in scope
abs(float __x)
^
/project/projectdirs/m1759/csdaley/software/cgpu/llvm/9.0.0-git_20190529/lib/clang/9.0.0/include/__clang_cuda_math_forward_declares.h:51:24:
note: target of using declaration
__DEVICE__ const float abs(const float);
^
/opt/gcc/7.3.0/snos/include/g++/bits/std_abs.h:52:11: note: using declaration
using ::abs;
^
2 errors generated.
csdaley at cgpu03:~/llvm> clang++ -v
clang version 9.0.0 (https://github.com/llvm-mirror/clang
e420b2015caea78d84601f697fbc33b6116ec622) (https://github.com/llvm-mirror/llvm
36c062c0837bba4d6fc18b4132ab3df6a8cc4113)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/project/projectdirs/m1759/csdaley/software/cgpu/llvm/9.0.0-git_20190529/bin
Found candidate GCC installation:
/opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0
Selected GCC installation: /opt/gcc/7.3.0/snos/lib/gcc/x86_64-suse-linux/7.3.0
Candidate multilib: .;@m64
Selected multilib: .;@m64
Found CUDA installation: /global/common/cori/software/cuda/9.2, version 9.2
I have been in discussion with Doru and Johannes about this bug. They confirmed
that it is a bug and suggested putting the bug in bugzilla. The latest response
from Doru is
"The fix would be to remove the const float and const double variants of the
abs functions. This unfortunately will break the inclusion of the "random"
header.
I'm not sure how to reconcile those two errors, it looks like those two fixes
cannot coexist. Maybe I'm missing something."
Thanks,
Chris
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190529/afb580b8/attachment-0001.html>
More information about the llvm-bugs
mailing list