clang & llvm examples, e.g. AST Interpreter, Function Pointer Analysis, Value Range Analysis, Data-Flow Analysis, Andersen Pointer Analysis, LLVM Backend...
At Line 234, the condition of the BranchInst is dynamically casted into ICmpInst. However, the condition is not always ICmpInst. For example, it could be a CastInst which casts an i32 into an i1. In this case, the variable cmpInst would be null and a NPD will happen at line 236.
Commit
Latest Main
Location
Description
At Line 234, the
condition
of theBranchInst
is dynamically casted intoICmpInst
. However, thecondition
is not alwaysICmpInst
. For example, it could be aCastInst
which casts ani32
into ani1
. In this case, the variablecmpInst
would benull
and a NPD will happen at line236
.At Line 1092, the situation is similar.
Proposed Fix
guard this
dyn_cast
with aif