Skip to content

Commit 2e2e22c

Browse files
Use the correct element type when mapping a struct field (#40)
1 parent d4c9fcc commit 2e2e22c

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/numba/openmp/libs/pass/CGIntrinsicsOpenMP.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1992,8 +1992,15 @@ void CGIntrinsicsOpenMP::emitOMPOffloadingMappings(
19921992
assert(BasePtr && "Expected non-null base pointer");
19931993
assert(Ptr && "Expected non-null pointer");
19941994

1995+
Type *ElementType = nullptr;
1996+
if (FieldTy->isPointerTy())
1997+
ElementType = FieldInfo.PointeeType;
1998+
else
1999+
ElementType = FieldTy;
2000+
assert(ElementType && "Expected non-null element type");
2001+
19952002
auto ElementSize = ConstantInt::get(
1996-
OMPBuilder.SizeTy, M.getDataLayout().getTypeAllocSize(FieldTy));
2003+
OMPBuilder.SizeTy, M.getDataLayout().getTypeAllocSize(ElementType));
19972004
Value *NumElements = nullptr;
19982005

19992006
// Load the value of NumElements if it is a pointer.

0 commit comments

Comments
 (0)