r292590 - [OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 27 09:14:30 PST 2017


Thanks a lot

-------------
Best regards,
Alexey Bataev

27.01.2017 19:57, Hans Wennborg пишет:
> I've got it. Merged in r293302.
>
> Thanks,
> Hans
>
> On Fri, Jan 27, 2017 at 4:49 AM, Alexey Bataev <a.bataev at hotmail.com> wrote:
>> Yes. Could you do it yourself or you want me to do it?
>>
>> -------------
>> Best regards,
>> Alexey Bataev
>>
>> 27.01.2017 2:33, Hans Wennborg пишет:
>>> Should we merge this to the release branch?
>>>
>>> On Fri, Jan 20, 2017 at 12:57 AM, Alexey Bataev via cfe-commits
>>> <cfe-commits at lists.llvm.org> wrote:
>>>> Author: abataev
>>>> Date: Fri Jan 20 02:57:28 2017
>>>> New Revision: 292590
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=292590&view=rev
>>>> Log:
>>>> [OPENMP] Fix for PR31643: Clang crashes when compiling code on Windows
>>>> with SEH and openmp
>>>>
>>>> In some cituations (during codegen for Windows SEH constructs)
>>>> CodeGenFunction instance may have CurFn equal to nullptr. OpenMP related
>>>> code does not expect such situation during cleanup.
>>>>
>>>> Added:
>>>>       cfe/trunk/test/OpenMP/openmp_seh.c
>>>> Modified:
>>>>       cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
>>>>
>>>> Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=292590&r1=292589&r2=292590&view=diff
>>>> ==============================================================================
>>>> --- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
>>>> +++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Jan 20 02:57:28 2017
>>>> @@ -112,9 +112,8 @@ CodeGenFunction::~CodeGenFunction() {
>>>>      if (FirstBlockInfo)
>>>>        destroyBlockInfos(FirstBlockInfo);
>>>>
>>>> -  if (getLangOpts().OpenMP) {
>>>> +  if (getLangOpts().OpenMP && CurFn)
>>>>        CGM.getOpenMPRuntime().functionFinished(*this);
>>>> -  }
>>>>    }
>>>>
>>>>    CharUnits CodeGenFunction::getNaturalPointeeTypeAlignment(QualType T,
>>>>
>>>> Added: cfe/trunk/test/OpenMP/openmp_seh.c
>>>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/openmp_seh.c?rev=292590&view=auto
>>>> ==============================================================================
>>>> --- cfe/trunk/test/OpenMP/openmp_seh.c (added)
>>>> +++ cfe/trunk/test/OpenMP/openmp_seh.c Fri Jan 20 02:57:28 2017
>>>> @@ -0,0 +1,18 @@
>>>> +// RUN: %clang_cc1 -verify -triple x86_64-pc-windows-msvc19.0.0 -fopenmp -fms-compatibility -x c++ -emit-llvm %s -o - | FileCheck %s
>>>> +// expected-no-diagnostics
>>>> +// REQUIRES: x86-registered-target
>>>> +extern "C" {
>>>> +void __cpuid(int[4], int);
>>>> +}
>>>> +
>>>> +// CHECK-LABEL: @main
>>>> +int main(void) {
>>>> +  __try {
>>>> +    int info[4];
>>>> +    __cpuid(info, 1);
>>>> +  } __except (1) {
>>>> +  }
>>>> +
>>>> +  return 0;
>>>> +}
>>>> +
>>>>
>>>>
>>>> _______________________________________________
>>>> cfe-commits mailing list
>>>> cfe-commits at lists.llvm.org
>>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits



More information about the cfe-commits mailing list