https://bugs.llvm.org/show_bug.cgi?id=45118
Bug ID: 45118
Summary: Verifier - nullptr dereference warning
Product: libraries
Version: trunk
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Core LLVM classes
Assignee: unassignedb...@nondot.org
Reporter: llvm-...@redking.me.uk
CC: ane...@apple.com, apra...@apple.com,
llvm-bugs@lists.llvm.org, orlando.hy...@sony.com
http://lab.llvm.org:8080/coverage/coverage-reports/llvm/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/lib/IR/Verifier.cpp.html
Static analysis warns that the SP variable is dereferenced as null:
DILocalScope *Scope = DL->getInlinedAtScope();
if (Scope && !Seen.insert(Scope).second)
return;
DISubprogram *SP = Scope ? Scope->getSubprogram() : nullptr;
// Scope and SP could be the same MDNode and we don't want to skip
// validation in that case
if (SP && ((Scope != SP) && !Seen.insert(SP).second))
return;
AssertDI(SP->describes(&F),
"!dbg attachment points at wrong subprogram for function", N, &F,
&I, DL, Scope, SP);
AFAICT the Scope variable will always be non-null (and we should just assert
that it is), allowing us to simplify the code to something like the below (my
main concern is I'm not sure on how the verifier assertions are supposed to be
implemented):
DILocalScope *Scope = DL->getInlinedAtScope();
assert(Scope && "Unknown inlined scope"); <-- NOT FAMILIAR WITH THE
VERIFIER ASSERTION MECHANISM
if (!Seen.insert(Scope).second)
return;
DISubprogram *SP = Scope->getSubprogram();
assert(SP && "Unknown scope subprogram"); <-- NOT FAMILIAR WITH THE
VERIFIER ASSERTION MECHANISM
// Scope and SP could be the same MDNode and we don't want to skip
// validation in that case
if (((Scope != SP) && !Seen.insert(SP).second))
return;
AssertDI(SP->describes(&F),
"!dbg attachment points at wrong subprogram for function", N, &F,
&I, DL, Scope, SP);
--
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