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: unassignedclangb...@nondot.org
          Reporter: jonathanchesterfi...@gmail.com
                CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to