Skip to content

Commit d936c0c

Browse files
authored
[Clang] [OMPIRBuilder] Prevent Null Pointer Dereference in OpenMP IR Builder (#115506)
This commit addresses Static Analyzer issues related to potential null dereference by replacing dyn_cast<> with cast<> in OMPIRBuilder.cpp to ensure that ArgStructType is not null before it is used, improving the stability and reliability of the code.
1 parent 9424f3d commit d936c0c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6962,8 +6962,7 @@ static Function *emitTargetTaskProxyFunction(OpenMPIRBuilder &OMPBuilder,
69626962
assert(ArgStructAlloca &&
69636963
"Unable to find the alloca instruction corresponding to arguments "
69646964
"for extracted function");
6965-
auto *ArgStructType =
6966-
dyn_cast<StructType>(ArgStructAlloca->getAllocatedType());
6965+
auto *ArgStructType = cast<StructType>(ArgStructAlloca->getAllocatedType());
69676966

69686967
AllocaInst *NewArgStructAlloca =
69696968
Builder.CreateAlloca(ArgStructType, nullptr, "structArg");

0 commit comments

Comments
 (0)