<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 12.0.0 new ICE on templated C++ code involving OpenMP and lambda function"
   href="https://bugs.llvm.org/show_bug.cgi?id=50077">50077</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang 12.0.0 new ICE on templated C++ code involving OpenMP and lambda function
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </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>normal
          </td>
        </tr>

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

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

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

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

        <tr>
          <th>CC</th>
          <td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Clang 12.0.0 crashes when trying to build a C++ file at my workplace having a
combination of OpenMP pragma, templates, and lambda function passed into the
template function.  Compilation was in C++17 mode.  I'll attach the relevant
files momentarily.

This is a regression -- version 10.0.1 compiled the file without issue.  I have
not tested with intermediate versions.

(Note, I selected "trunk" for the Version field since 12.0 is not yet available
as an option there.)


Some remarks follow on how the relevant Clang binaries were built from source,
which may or may not be relevant to the ICE.

The Clang 10.0.1 instance (that succeeds) was built from source on RedHat
Enterprise Linux 6.6 (yes ancient I know :-) using an instance of GCC 7.3 that
was also built on the same platform.  The compilation succeeds with this Clang
binary both on RHEL 6.6 and on RHEL 7.2 machines.

The Clang 12.0.0 instance (that crashes) was built from source on RHEL 7.2
using an instance of GCC 7.3 that was also built on RHEL 7.2.

In both cases, the Clang instance was compiled from the llvm-<version>.tar.xz,
clang-<version>.tar.xz and openmp-<version>.tar.xz source files.  Note that
they were compiled to use the GCC 7.3 instance's libstdc++ (libc++ is not
involved at all).  Relevant build configuration was in both cases as follows
with $VER having been set to 10.0.1 or 12.0.0 as appropriate:

export CXXFLAGS=-fno-strict-aliasing
cmake -G "Unix Makefiles" ../llvm-$VER.src \
        -DCMAKE_INSTALL_PREFIX=/usr/devsrc/llvm-$VER \
        -DCMAKE_C_COMPILER=/usr/local/gcc73/bin/gcc \
        -DCMAKE_CXX_COMPILER=/usr/local/gcc73/bin/g++ \
        -DCMAKE_BUILD_TYPE=Release \
        -DLLVM_TARGETS_TO_BUILD=X86 \
        -DOPENMP_ENABLE_LIBOMPTARGET=OFF \
        -DGCC_INSTALL_PREFIX=/usr/local/gcc73

N.B. I pass -DOPENMP_ENABLE_LIBOMPTARGET=OFF since otherwise 'nvcc' had errored
out during a previous build (of Clang 7), and I wasn't motivated enough to
figure out how to fix, nor to see if the problem was gone in later versions.
*** This does not prevent it from building libomp.so. ***

Cmake version used was 3.7.0 (hand-built) for the Clang 10.0.1 build, and
3.17.0 (again, hand-built) for the Clang 12.0.0 build.


In order to allow LLVM 12.0.0 to build on RHEL7, I had to modify its
CMakeLists.txt and two files under cmake/ in order to force it to use the
system Python 2.7.5, rather than using Python3 that the cmake files claim to
need but which the RHEL7 OS doesn't supply by default.  After this
modification, LLVM + Clang + OpenMP built and installed without complaint.  I
doubt that this is related to the ICE, since the Clang binary appeared to
compile the rest of our source code without issue, but I mention it in the
interests of completeness.</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>