[deadstore] False positive caused by exceptional cfg

Summary:
The title

Also notice that there is a duplication of an error.

Reviewed By: skcho

Differential Revision: D27426933

fbshipit-source-id: dbd2f861a
master
Daiva Naudziuniene 4 years ago committed by Facebook GitHub Bot
parent 8f3cda4b1a
commit a947961d76

@ -539,6 +539,20 @@ class Exceptions {
return 3;
}
int return_in_try_in_for_ok() {
constexpr int i1 = 3;
for (int i = 1;; ++i) {
try {
return maybe_throw();
} catch (const char* msg) {
if (i1 == i) {
return 2;
}
}
}
return 3;
}
int read_in_catch_ok() {
int x;
try {

@ -1,6 +1,8 @@
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::dead_in_catch_bad, 4, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::not_read_in_catch_bad, 3, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::read_only_in_catch_bad, 5, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::return_in_try_in_for_ok, 2, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::return_in_try_in_for_ok, 2, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::Exceptions::unreachable_catch_bad, 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::FP_assign_array_tricky2_ok, 3, DEAD_STORE, no_bucket, ERROR, [Write of unused value]
codetoanalyze/cpp/liveness/dead_stores.cpp, dead_stores::binaryConditional_bad, 1, DEAD_STORE, no_bucket, ERROR, [Write of unused value]

Loading…
Cancel
Save