[llvm-bugs] [Bug 52477] New: Fail to compile clang_hip_math with libc++

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Nov 11 08:33:38 PST 2021


https://bugs.llvm.org/show_bug.cgi?id=52477

            Bug ID: 52477
           Summary: Fail to compile clang_hip_math with libc++
           Product: OpenMP
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Clang Compiler Support
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jonathanchesterfield at gmail.com
                CC: llvm-bugs at lists.llvm.org

Reported by Wael Elwasif,

 #include <omp.h>
 #include <cmath>
 #include <cstdio>

 int main(int argc, char **argv){
       double a = -1.0;

 #pragma omp target map(tofrom: a)
       {
       a = std::abs(a);
       }
       printf("a = %lf\n", a);
 }

...
 In file included from
 llvm/14.0.0-20211110/lib/clang/14.0.0/include/__clang_hip_math.h:18:
 In file included from
 llvm/14.0.0-20211110/bin/../include/c++/v1/algorithm:653:
...
 llvm/14.0.0-20211110/bin/../include/c++/v1/__threading_support:735:12:
 error: calling a private constructor of class 'std::__thread_id'
       return __libcpp_thread_get_current_id();

OpenMP currently uses __clang_hip_math.h in the libm implementation. That
header includes <algorithm>, although amdgpu doesn't have a libc++, and that
includes shared_ptr and then threading_support and then falls over.

Fix is to drop algorithm from clang_hip_math.h, which really shouldn't be
including any of the c++ standard library

-- 
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/20211111/c1e339f6/attachment.html>


More information about the llvm-bugs mailing list