[PATCH] D91370: [OPENMP]Fix PR48076: Check map types array before accessing its front.
Joseph Huber via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 12 14:57:22 PST 2020
jhuber6 added a comment.
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.
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