[llvm-bugs] [Bug 51316] New: False positive for clang static analyzer checker optin.cplusplus.UninitializedObject
via llvm-bugs
llvm-bugs at lists.llvm.org
Tue Aug 3 03:10:50 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=51316
Bug ID: 51316
Summary: False positive for clang static analyzer checker
optin.cplusplus.UninitializedObject
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: C++
Assignee: unassignedclangbugs at nondot.org
Reporter: smallcsf at yandex.ru
CC: blitzrakete at gmail.com, dgregor at apple.com,
erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
richard-llvm at metafoo.co.uk
Checker UninitializedObject is enable by default in clang-tidy and reports
some false positives. Tests case(UninitializedObjectChecker_false_positive.cpp)
:
-----------------------------------------
struct Operand_ {
int e;
int a[2];
};
class b : Operand_ {
public:
b() : Operand_{ 1, { 2, 3 }} {}
};
void c() { b(); }
-----------------------------------------
It returns wrong warning:
-----------------------------------------
UninitializedObjectChecker_false_positive.cpp:9:17: warning: 1 uninitialized
field at the end of the constructor call [optin.cplusplus.UninitializedObject]
b() : Operand_{ 1, { 2, 3 }} {}
^~~~~~~~~~~~~~
UninitializedObjectChecker_false_positive.cpp:3:7: note: uninitialized field
'this->Operand_::e'
int e;
^
1 warning generated.
-----------------------------------------
Arguments for clang-12 or clangs-13 in trunk:
-----------------------------------------
clang-12 -c UninitializedObjectChecker_false_positive.cpp -Xclang
-analyzer-checker=optin.cplusplus.UninitializedObject -Xclang -analyze
-----------------------------------------
--
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/20210803/f309c329/attachment-0001.html>
More information about the llvm-bugs
mailing list