[llvm-bugs] [Bug 45120] New: Analyzer fails to account for constructor initialization
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Mar 5 06:56:36 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=45120
Bug ID: 45120
Summary: Analyzer fails to account for constructor
initialization
Product: clang
Version: unspecified
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: llvm-dev at redking.me.uk
CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org
https://llvm.org/reports/scan-build/report-DeclTemplate.cpp-TemplateParameterList-27-1.html#EndPath
TemplateParameterList::TemplateParameterList(const ASTContext& C,
SourceLocation TemplateLoc,
SourceLocation LAngleLoc,
ArrayRef<NamedDecl *> Params,
SourceLocation RAngleLoc,
Expr *RequiresClause)
: TemplateLoc(TemplateLoc), LAngleLoc(LAngleLoc), RAngleLoc(RAngleLoc),
NumParams(Params.size()), ContainsUnexpandedParameterPack(false),
HasRequiresClause(RequiresClause != nullptr),
HasConstrainedParameters(false) {
........
if (HasRequiresClause) {
if (RequiresClause->containsUnexpandedParameterPack())
ContainsUnexpandedParameterPack = true;
*getTrailingObjects<Expr *>() = RequiresClause;
}
}
The static analyzer is warning about a null pointer dereference for
RequiresClause, but we will only reach this code if HasRequiresClause is true,
which is set by a non-null RequiresClause value in the initializer list at the
top of the constructor.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200305/d8dca1ed/attachment-0001.html>
More information about the llvm-bugs
mailing list