Open Quuxplusone opened 7 years ago
Attached clang-tidy-error-ex.cpp
(282 bytes, text/x-c++src): minimal working example for the bug
Here's a similar code snippet with just one try-catch block that
produces a false positive with the command
clang-tidy -checks='-*,clang-analyzer-deadcode.DeadStores' bug.cc --
============================
void foo() { throw 0; }
int main()
{
int i = 0;
try
{
i = 1;
foo();
return 0;
}
catch(...) {}
return i;
}
============================
bug.cc:9:5: warning: Value stored to 'i' is never read [clang-analyzer-
deadcode.DeadStores]
i = 1;
^
bug.cc:9:5: note: Value stored to 'i' is never read
Since the program actually returns 1, the store in line 9 cannot be dead.
This happens since clang 3.5.0.
Same with the following example (in version 3.9):
#include <iostream>
void configure() { throw 0;}
int main()
{
bool configured = true;
for (int i = 0; i < 10 ; ++i)
{
try {
configured = false;
configure();
configured = true;
}
catch (...) {}
}
std::cout << configured << std::endl;
}
analyzer complains that store configured = false
is never read, but as the output statement shows, we are able to observe the store.
Is Ted still a good default assignee for the SA bugs?
(In reply to Alexander Kornienko from comment #3)
> Is Ted still a good default assignee for the SA bugs?
I doubt that, he is no longer the official owner/maintainer of the SA codebase.
I think Anna would be a better default.
I am CC-ed on all of Ted's bugs. I'll ask Tanya to set the screener to either me or someone else on our team.
clang-tidy-error-ex.cpp
(282 bytes, text/x-c++src)