<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 crashes when compiling code on Windows with SEH and openmp"
   href="https://llvm.org/bugs/show_bug.cgi?id=31643">31643</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang crashes when compiling code on Windows with SEH and openmp
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

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

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

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=17841" name="attach_17841" title="Crash dump + source code + simple bat to run">attachment 17841</a> <a href="attachment.cgi?id=17841&action=edit" title="Crash dump + source code + simple bat to run">[details]</a></span>
Crash dump + source code + simple bat to run

If I compile this reduced code:

extern "C" {
    void __cpuid(int[4], int);
}

int main( void )
{
    __try
    {
        int info[4];
        __cpuid(info, 1);
    }
    __except (1)
    {
    }

    return 0;
}


With command:
clang.exe "-cc1" "-triple" "x86_64-pc-windows-msvc19.0.0" "-emit-obj"
"-fms-compatibility" "-fopenmp" "test.cpp"

Then I receive an error:
Assertion failed: CGF.CurFn && "No function in current CodeGenFunction.", file
D:\src\llvm_package_288665\llvm\tools\clang\lib\CodeGen\CGOpenMPRuntime.cpp,
line 1030
Wrote crash dump file "C:\Users\AdamF\AppData\Local\Temp\clang.exe-e99388.dmp"
0x024B9CE8 (0x00000016 0x03DA3FE7 0x00D9BFA0 0x02767F5D)
0x03DAE515 (0x0494A340 0x0494A10E 0x00000406 0x00000003)
0x03DA3EA1 (0x0494A340 0x0494A10E 0x00000406 0x00C5C058)
0x03DA4089 (0x0494A340 0x0494A10E 0x00000406 0x00D9C898)
0x02767F5D (0x00C5D038 0x00D949B8 0x00D94700 0x0000006C)
0x036D8405 (0x00000000 0x00000000 0x00D59A98 0x00000007)

Crash dump + source code + simple bat to run in attachment</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>