[PATCH] D91370: [OPENMP]Fix PR48076: Check map types array before accessing its front.

Alexey Bataev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 12 15:15:08 PST 2020


ABataev added a comment.

In D91370#2392641 <https://reviews.llvm.org/D91370#2392641>, @jhuber6 wrote:

> In D91370#2392616 <https://reviews.llvm.org/D91370#2392616>, @ABataev wrote:
>
>> Could you try this patch:
>>
>>   diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
>>   index ce8846140d4..854b7f3e830 100644
>>   --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
>>   +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
>>   @@ -9938,7 +9938,7 @@ void CGOpenMPRuntime::emitTargetCall(
>>              MappedVarSet.insert(CI->getCapturedVar());
>>            else
>>              MappedVarSet.insert(nullptr);
>>   -        if (CurInfo.BasePointers.empty())
>>   +        if (CurInfo.BasePointers.empty() && !PartialStruct.Base.isValid())
>>              MEHandler.generateDefaultMapInfo(*CI, **RI, *CV, CurInfo);
>>            // Generate correct mapping for variables captured by reference in
>>            // lambdas.
>>   @@ -9947,7 +9947,7 @@ void CGOpenMPRuntime::emitTargetCall(
>>                                                      CurInfo, LambdaPointers);
>>          }
>>          // We expect to have at least an element of information for this capture.
>>   -      assert(!CurInfo.BasePointers.empty() &&
>>   +      assert((!CurInfo.BasePointers.empty() || PartialStruct.Base.isValid()) &&
>>                 "Non-existing map pointer for capture!");
>>          assert(CurInfo.BasePointers.size() == CurInfo.Pointers.size() &&
>>                 CurInfo.BasePointers.size() == CurInfo.Sizes.size() &&
>
> Also I'm assuming you meant for this to be applied to the master breanch, and not in addition to the previous one.

Yes, it was against master. Will check it tomorrow, looks like need to fix mapping flags. Also, the patch itself needs to be fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91370/new/

https://reviews.llvm.org/D91370



More information about the cfe-commits mailing list