https://bugs.llvm.org/show_bug.cgi?id=43366
Bug ID: 43366
Summary: If dyn_cast<TYPE>(X) is non-null, assume X is non-null
as well?
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcough...@apple.com
Reporter: llvm-...@redking.me.uk
CC: dcough...@apple.com, llvm-bugs@lists.llvm.org,
noqnoq...@gmail.com
Noticed here:
https://llvm.org/reports/scan-build/report-AArch64TargetTransformInfo.cpp-getValueType-12-1.html#EndPath
if (auto *VTy = dyn_cast<VectorType>(Ty)) {
Type *EltTy = VTy->getElementType();
// Lower vectors of pointers to native pointer types.
if (auto *PTy = dyn_cast<PointerType>(EltTy)) {
EVT PointerTy(getPointerTy(DL, PTy->getAddressSpace()));
EltTy = PointerTy.getTypeForEVT(Ty->getContext());
}
return EVT::getVectorVT(Ty->getContext(), EVT::getEVT(EltTy, false),
VTy->getElementCount());
}
The warning says that Ty->getContext() can be a null pointer, but if we know
that VTy is non-null and is a dyn_cast from Ty, then shouldn't Ty be known to
be non-null?
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs