[llvm-bugs] [Bug 40239] New: Incompatible C++ headers when compiling with -fopenmp-targets=nvptx64-nvidia-cuda
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jan 6 19:11:15 PST 2019
https://bugs.llvm.org/show_bug.cgi?id=40239
Bug ID: 40239
Summary: Incompatible C++ headers when compiling with
-fopenmp-targets=nvptx64-nvidia-cuda
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
The iostream and algorithm header files cause compilation errors when compiled
with -fopenmp-targets=nvptx64-nvidia-cuda. This happens on Intel Haswell but
not on IBM Power 8.
$ cat hello.cxx
#include <iostream>
#include <algorithm>
int main()
{
std::cout << "hello" << std::endl;
return 0;
}
The following works:
$ clang++ hello.cxx -fopenmp -o hello && ./hello
hello
The following fails:
$ clang++ hello.cxx -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o hello &&
./hello
In file included from hello.cxx:1:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/iostream:39:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ostream:38:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/ios:40:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/char_traits.h:39:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_algobase.h:64:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_pair.h:59:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/move.h:57:
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/type_traits:269:39:
error: __float128 is not supported
on this target
struct __is_floating_point_helper<__float128>
^
In file included from hello.cxx:2:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/algorithm:62:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_algo.h:65:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/random:51:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux/bits/opt_random.h:33:
In file included from
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/x86intrin.h:29:
In file included from
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/immintrin.h:427:
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/pconfigintrin.h:42:14:
error: invalid output
constraint '=a' in asm
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
^
In file included from hello.cxx:2:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/algorithm:62:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/bits/stl_algo.h:65:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/random:51:
In file included from
/usr/lib/gcc/x86_64-redhat-linux/4.8.5/../../../../include/c++/4.8.5/x86_64-redhat-linux/bits/opt_random.h:33:
In file included from
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/x86intrin.h:29:
In file included from
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/immintrin.h:431:
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/sgxintrin.h:40:14:
error: invalid output
constraint '=a' in asm
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
^
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/sgxintrin.h:51:14:
error: invalid output
constraint '=a' in asm
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
^
/home/chrisdaley/software/llvm/8.0.0-git_20190105/lib/clang/8.0.0/include/sgxintrin.h:62:14:
error: invalid output
constraint '=a' in asm
: "=a" (__result), "=b" (__d[0]), "=c" (__d[1]), "=d" (__d[2])
^
5 errors generated.
I can avoid the error from the iostream header file by compiling against the
2011 ISO C++ standard using -std=c++11, but the error from the algorithm header
file remains. I can avoid both errors by using a different GCC toolchain, but I
don't know if this is advised:
$ clang++ -std=c++11
--gcc-toolchain=/home/chrisdaley/software/gcc/8.2.0-offload hello.cxx -fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda -o hello && ./hello
hello
Finally, I can also avoid both errors by compiling against the 1998 ISO C++
standard. Although unfortunately I need to use C++11 in my real code.
$ clang++ -std=c++98 hello.cxx -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda -o
hello && ./hello
hello
$ clang++ -v
clang version 8.0.0 (https://github.com/llvm-mirror/clang
53e3c74f8e4c55f5122bdd1cab090fd21daa9ce2) (https://github.com/llvm-mirror/llvm
bfaf433903bc707a4320b02b34e0c39da1fcfc85)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/chrisdaley/software/llvm/8.0.0-git_20190105/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
Found CUDA installation: /cm/extra/apps/CUDA.linux86-64/9.2.88.1_396.26,
version 9.2
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/20190107/27fa21b0/attachment-0001.html>
More information about the llvm-bugs
mailing list