<div dir="ltr">Thanks! Does this match the logic for starting a function in OpenMP?<div><br></div><div>Also, the test shouldn't have REQUIRES: x86-registered-target.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 20, 2017 at 12:57 AM, Alexey Bataev via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: abataev<br>
Date: Fri Jan 20 02:57:28 2017<br>
New Revision: 292590<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=292590&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=292590&view=rev</a><br>
Log:<br>
[OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows<br>
with SEH and openmp<br>
<br>
In some cituations (during codegen for Windows SEH constructs)<br>
CodeGenFunction instance may have CurFn equal to nullptr. OpenMP related<br>
code does not expect such situation during cleanup.<br>
<br>
Added:<br>
cfe/trunk/test/OpenMP/openmp_<wbr>seh.c<br>
Modified:<br>
cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp<br>
<br>
Modified: cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=292590&r1=292589&r2=292590&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp?rev=<wbr>292590&r1=292589&r2=292590&<wbr>view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp (original)<br>
+++ cfe/trunk/lib/CodeGen/<wbr>CodeGenFunction.cpp Fri Jan 20 02:57:28 2017<br>
@@ -112,9 +112,8 @@ CodeGenFunction::~<wbr>CodeGenFunction() {<br>
if (FirstBlockInfo)<br>
destroyBlockInfos(<wbr>FirstBlockInfo);<br>
<br>
- if (getLangOpts().OpenMP) {<br>
+ if (getLangOpts().OpenMP && CurFn)<br>
CGM.getOpenMPRuntime().<wbr>functionFinished(*this);<br>
- }<br>
}<br>
<br>
CharUnits CodeGenFunction::<wbr>getNaturalPointeeTypeAlignment<wbr>(QualType T,<br>
<br>
Added: cfe/trunk/test/OpenMP/openmp_<wbr>seh.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/openmp_seh.c?rev=292590&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/cfe/trunk/test/OpenMP/<wbr>openmp_seh.c?rev=292590&view=<wbr>auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- cfe/trunk/test/OpenMP/openmp_<wbr>seh.c (added)<br>
+++ cfe/trunk/test/OpenMP/openmp_<wbr>seh.c Fri Jan 20 02:57:28 2017<br>
@@ -0,0 +1,18 @@<br>
+// RUN: %clang_cc1 -verify -triple x86_64-pc-windows-msvc19.0.0 -fopenmp -fms-compatibility -x c++ -emit-llvm %s -o - | FileCheck %s<br>
+// expected-no-diagnostics<br>
+// REQUIRES: x86-registered-target<br>
+extern "C" {<br>
+void __cpuid(int[4], int);<br>
+}<br>
+<br>
+// CHECK-LABEL: @main<br>
+int main(void) {<br>
+ __try {<br>
+ int info[4];<br>
+ __cpuid(info, 1);<br>
+ } __except (1) {<br>
+ }<br>
+<br>
+ return 0;<br>
+}<br>
+<br>
<br>
<br>
______________________________<wbr>_________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>