<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 - Clang compilation error with math.h when using openmp offload"
   href="https://bugs.llvm.org/show_bug.cgi?id=38464">38464</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang compilation error with math.h when using openmp offload
          </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>xw111luoye@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm exploring the openmp offload feature of llvm+clang and hit some compiler
error. I built the master branch of llvm+clang+opemp with clang7.

Now when compiling miniQMC offload branch.
<a href="https://github.com/QMCPACK/miniqmc/tree/OMP_offload">https://github.com/QMCPACK/miniqmc/tree/OMP_offload</a>
mkdir build_clang_offload; cd build_clang_offload
cmake -DCMAKE_CXX_COMPILER="clang++" -DQMC_MPI=0 -DENABLE_OFFLOAD=1 ..
make
I got the following error

[  2%] Building CXX object
src/CMakeFiles/qmcbase.dir/Particle/ParticleSet.cpp.o
cd /sandbox/opt/miniqmc/build_clang_offload/src &&
/sandbox/opt/llvm-clang/clang-offload/bin/clang++  -DADD_ -DH5_USE_16_API
-DHAVE_CONFIG_H -DINLINE_ALL=inline -DUSE_REAL_STRUCT_FACTOR
-Drestrict=__restrict__ -I/sandbox/opt/miniqmc/src
-I/sandbox/opt/miniqmc/build_clang_offload/src 
--gcc-toolchain=/soft/apps/packages/gcc/gcc-6.2.0 -fopenmp
-fopenmp-targets=nvptx64-nvidia-cuda -fomit-frame-pointer -fstrict-aliasing
-D__forceinline=inline -Wno-deprecated -Wno-unused-value
-Wno-undefined-var-template -O3 -DNDEBUG -ffast-math   -std=c++11 -o
CMakeFiles/qmcbase.dir/Particle/ParticleSet.cpp.o -c
/sandbox/opt/miniqmc/src/Particle/ParticleSet.cpp
In file included from /sandbox/opt/miniqmc/src/Particle/ParticleSet.cpp:32:
In file included from /sandbox/opt/miniqmc/src/Particle/ParticleSet.h:34:
In file included from /sandbox/opt/miniqmc/src/Utilities/Configuration.h:27:
In file included from
/soft/apps/packages/gcc/gcc-6.2.0/lib/gcc/x86_64-pc-linux-gnu/6.2.0/../../../../include/c++/6.2.0/complex:44:
In file included from
/soft/apps/packages/gcc/gcc-6.2.0/lib/gcc/x86_64-pc-linux-gnu/6.2.0/../../../../include/c++/6.2.0/cmath:45:
In file included from /usr/include/math.h:426:
/usr/include/x86_64-linux-gnu/bits/mathinline.h:131:43: error: invalid input
constraint 'x' in asm
  __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));
                                          ^
/usr/include/x86_64-linux-gnu/bits/mathinline.h:143:43: error: invalid input
constraint 'x' in asm
  __asm ("pmovmskb %1, %0" : "=r" (__m) : "x" (__x));

Actually the code involved in this complication doesn't contain offload code at
all. If I simply remove -fopenmp-targets=nvptx64-nvidia-cuda, the compilation
goes through.</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>