<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-cl 8.0.0 crashes with OpenMP construct"
   href="https://bugs.llvm.org/show_bug.cgi?id=41617">41617</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang-cl 8.0.0 crashes with OpenMP construct
          </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>Windows NT
          </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>Runtime Library
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>powerchord@web.de
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21827" name="attach_21827" title="Preprocessed source and associated run script">attachment 21827</a> <a href="attachment.cgi?id=21827&action=edit" title="Preprocessed source and associated run script">[details]</a></span>
Preprocessed source and associated run script

clang-cl crashes with the following code:

void f()
{
    int e;
    auto g = [e] (auto)  // a concrete parameter type (like 'int') instead of
'auto' is OK
    {
        #pragma omp critical
        e;
    };

    #pragma omp parallel for
    for (int i = 0; i < 42; ++i)
        g(i);
}

Please note that it does compile with a concrete parameter type for the lambda
instead of the generic auto.

Compiled with "-Xclang -fopenmp /std:c++latest" in VS2019 using LLVM_v142
toolset from llvm-utils.
The error report is:

1>clang-cl: error: clang frontend command failed due to signal (use -v to see
invocation)
1>clang version 8.0.0 (tags/RELEASE_800/final)
1>Target: i386-pc-windows-msvc
1>Thread model: posix
1>InstalledDir: C:\Program Files\LLVM\bin
1>clang-cl: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
1>clang-cl: note: diagnostic msg:
1>********************
1>PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
1>Preprocessed source(s) and associated run script(s) are located at:
1>clang-cl: note: diagnostic msg:
C:\Users\x\AppData\Local\Temp\Source-1b17c7.cpp
1>clang-cl: note: diagnostic msg:
C:\Users\x\AppData\Local\Temp\Source-1b17c7.sh
1>clang-cl: note: diagnostic msg:
1>********************
1>C:\Program Files (x86)\Microsoft Visual
Studio\2019\Preview\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(423,5):
error MSB6006: "C:\Program Files\LLVM\bin\clang-cl.exe" exited with code 1.
1>Done building project "Project2.vcxproj" -- FAILED.

The code is a simplified stripped down version of real production code. I know
that it does effectively nothing, I just wanted it to be as simple as possible.
It should compile nonetheless.

It also does not compile on godbolt's clang (<a href="https://godbolt.org/z/zi0aVI">https://godbolt.org/z/zi0aVI</a>).</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>