This is an archive of the discontinued LLVM Phabricator instance.

[OPENMP] Fix assertion in clang::ASTContext::getTypeInfoImpl
Needs ReviewPublic

Authored by jyu2 on Mar 31 2022, 3:06 PM.

Details

Summary

The problem is when mapping of array section, currently call
getTypeSizeInChars with BuiltinType::OMPArraySection causing assert.

One way to fix this is using array element type instead.

BTW with this fix, test will fail in libomptarget.so
with error message: double free or corruption (out)
But it passes with intel customized libomptarget.so

I am not sure it is clang problem. I will submit issues to
libtarget after this checked in for more investigation.

Diff Detail

Event Timeline

jyu2 created this revision.Mar 31 2022, 3:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 3:06 PM
jyu2 requested review of this revision.Mar 31 2022, 3:06 PM
ABataev added inline comments.Apr 1 2022, 5:35 AM
clang/lib/CodeGen/CGOpenMPRuntime.cpp
8072–8088

Why not something like:

llvm::Value *TypeSize = CGF.getTypeSize(CanonType);
llvm::Value *Idx = CGF.Builder.CreateSub(TypeSize, 1);
Address HB = CGF.Builder.CreateGEP(
              CGF.Builder.CreatePointerBitCastOrAddrSpaceCast(
                  LowestElem, CGF.VoidPtrTy, CGF.Int8Ty),
             Idx);