llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.35k stars 12.14k forks source link

_GLIBCXX_USE_C99_COMPLEX_ARC not set to 0 in Headers/cuda_wrappers/complex #113332

Open VinInn opened 1 month ago

VinInn commented 1 month ago

If I compile with clang++ --offload-arch=native -xhip -march=native -stdlib=libstdc++ oneComplex_hip.cpp I get things like lld: error: undefined hidden symbol: cacosh

referenced by /tmp/innocent/oneComplex_hip-gfx900-400399.o:(std::complex_acosh(double complex)) referenced by /tmp/innocent/oneComplex_hip-gfx900-400399.o:(std::complex_acosh(double complex))

clang++: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)

while it does not complain for sin, sqrt,log etc this is most probably related to a bug I submitted to gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117151

If I add to that file (Headers/cuda_wrappers/complex)

ifdef FIXC99

warning fixing C99_ARC

pragma push_macro("_GLIBCXX_USE_C99_COMPLEX_ARC")

define _GLIBCXX_USE_C99_COMPLEX_ARC 0

endif

it compiles and run clang++ --offload-arch=native -xhip -march=native -stdlib=libstdc++ oneComplex_hip.cpp -DFIXC99 In file included from :1: In file included from /afs/cern.ch/work/i/innocent/public/w5/lib/clang/20/include/__clang_hip_runtime_wrapper.h:146: /afs/cern.ch/work/i/innocent/public/w5/lib/clang/20/include/cuda_wrappers/complex:76:2: warning: fixing C99_ARC [-W#warnings] 76 | #warning fixing C99_ARC

etc...

llvmbot commented 1 month ago

@llvm/issue-subscribers-clang-driver

Author: Vincenzo Innocente (VinInn)

If I compile with clang++ --offload-arch=native -xhip -march=native -stdlib=libstdc++ oneComplex_hip.cpp I get things like lld: error: undefined hidden symbol: cacosh >>> referenced by /tmp/innocent/oneComplex_hip-gfx900-400399.o:(std::__complex_acosh(double complex)) >>> referenced by /tmp/innocent/oneComplex_hip-gfx900-400399.o:(std::__complex_acosh(double complex)) clang++: error: amdgcn-link command failed with exit code 1 (use -v to see invocation) while it does not complain for sin, sqrt,log etc this is most probably related to a bug I submitted to gcc https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117151 If I add to that file (Headers/cuda_wrappers/complex) #ifdef FIXC99 #warning fixing C99_ARC #pragma push_macro("_GLIBCXX_USE_C99_COMPLEX_ARC") #define _GLIBCXX_USE_C99_COMPLEX_ARC 0 #endif it compiles and run clang++ --offload-arch=native -xhip -march=native -stdlib=libstdc++ oneComplex_hip.cpp -DFIXC99 In file included from <built-in>:1: In file included from /afs/cern.ch/work/i/innocent/public/w5/lib/clang/20/include/__clang_hip_runtime_wrapper.h:146: /afs/cern.ch/work/i/innocent/public/w5/lib/clang/20/include/cuda_wrappers/complex:76:2: warning: fixing C99_ARC [-W#warnings] 76 | #warning fixing C99_ARC etc...
VinInn commented 1 month ago

no issue with libc++ indeed (as it does not use C99 math: which could be an issue in itself, but of different nature)