[LLVMdev] Dereferencing NULL pointer in IndVarSimplify.cpp? (original) (raw)
Liang Wang netcasper at gmail.com
Fri Oct 17 17:21:12 PDT 2014
- Previous message: [LLVMdev] Query regarding LLVM compiler backend
- Next message: [LLVMdev] Dereferencing NULL pointer in IndVarSimplify.cpp?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
Here is the code in IndVarSimplify.cpp.
SmallVector<WeakVH, 16> DeadInsts;
while (!DeadInsts.empty()) if (Instruction *Inst = dyn_cast_or_null(&*DeadInsts.pop_back_val())) RecursivelyDeleteTriviallyDeadInstructions(Inst, TLI);
Since DeadInsts.pop_back_val() is WeakVH which could hold a NULL pointer, the expression, &*DeadInsts.pop_back_val(), could be &*NULL. Then NULL pointer is dereferenced here.
I wrote a small test case and it works just fine. But is this a well-defined behavior in the standard?
Thanks, Liang
- Previous message: [LLVMdev] Query regarding LLVM compiler backend
- Next message: [LLVMdev] Dereferencing NULL pointer in IndVarSimplify.cpp?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]