You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[SYCL][NFC] Fix bug with dereference null return value (#7275)
Reported by static analyzer tool.
Dereference null return value:
In <unnamed>::SyclKernelBodyCreator::enterArray(clang::FieldDecl *,
clang::QualType, clang::QualType): Return value of function which
returns null is dereferenced without checking
bool enterArray(FieldDecl *FD, QualType ArrayType,
QualType ElementType) final {
// returned_null: getAsConstantArrayType returns nullptr
// identity_transfer: Member function call
this->SemaRef->getASTContext()->getAsConstantArrayType(ArrayType)->getSize()
// returns an offset off
this->SemaRef->getASTContext()->getAsConstantArrayType(ArrayType)
(this).
// Dereference null return value (NULL_RETURNS) dereference:
Dereferencing a pointer that might be nullptr
this->SemaRef->getASTContext()->getAsConstantArrayType(ArrayType)->getSize()
when calling getZExtValue
uint64_t ArraySize = SemaRef.getASTContext()
.getAsConstantArrayType(ArrayType)
->getSize()
.getZExtValue();
addCollectionInitListExpr(ArrayType, ArraySize);
ArrayInfos.emplace_back(getFieldEntity(FD, ArrayType), 0);
This patch updates the codes to resolve the bug.
Signed-off-by: Soumi Manna <[email protected]>
Signed-off-by: Soumi Manna <[email protected]>
0 commit comments