<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Fail to compile clang_hip_math with libc++"
   href="https://bugs.llvm.org/show_bug.cgi?id=52477">52477</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Fail to compile clang_hip_math with libc++
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Clang Compiler Support
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>jonathanchesterfield@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>