[Pulse] Improve example to illustrate FP caused by an allocation in a branch

Summary: Recent improvements in join fixed `FP_allocate_in_branch_ok` because the variable was not read after the join.

Reviewed By: mbouaziz

Differential Revision: D13233441

fbshipit-source-id: 89b701e12
master
Daiva Naudziuniene 6 years ago committed by Facebook Github Bot
parent 0086c34364
commit e59d9632b1

@ -10,6 +10,7 @@ codetoanalyze/cpp/pulse/use_after_delete.cpp, reassign_field_of_deleted_bad, 3,
codetoanalyze/cpp/pulse/use_after_delete.cpp, return_deleted_bad, 3, USE_AFTER_DELETE, no_bucket, ERROR, [invalidated by call to `delete s` at line 24, column 3 here,accessed `s` here]
codetoanalyze/cpp/pulse/use_after_delete.cpp, use_in_branch_bad, 4, USE_AFTER_DELETE, no_bucket, ERROR, [invalidated by call to `delete s` at line 73, column 3 here,accessed `s` here]
codetoanalyze/cpp/pulse/use_after_delete.cpp, use_in_loop_bad, 4, USE_AFTER_DELETE, no_bucket, ERROR, [invalidated by call to `delete s` at line 102, column 3 here,accessed `s->f` here]
codetoanalyze/cpp/pulse/use_after_destructor.cpp, use_after_destructor::FP_allocate_in_branch_ok, 10, USE_AFTER_DESTRUCTOR, no_bucket, ERROR, [invalidated by destructor call `std::unique_ptr<use_after_destructor::A,std::default_delete<use_after_destructor::A>>_~unique_ptr(a2)` at line 245, column 10 here,accessed `a1` here]
codetoanalyze/cpp/pulse/use_after_destructor.cpp, use_after_destructor::double_destructor_bad, 5, USE_AFTER_DESTRUCTOR, no_bucket, ERROR, [invalidated by destructor call `use_after_destructor::S_~S(s)` at line 64, column 3 here,accessed `s` here]
codetoanalyze/cpp/pulse/use_after_destructor.cpp, use_after_destructor::placement_new_aliasing1_bad, 5, USE_AFTER_DELETE, no_bucket, ERROR, [invalidated by call to `delete alias` at line 142, column 3 here,accessed `s` here]
codetoanalyze/cpp/pulse/use_after_destructor.cpp, use_after_destructor::placement_new_aliasing2_bad, 5, USE_AFTER_DELETE, no_bucket, ERROR, [invalidated by call to `delete s` at line 150, column 3 here,accessed `alias` here]

@ -232,7 +232,7 @@ void FP_destructor_order_empty_destructor_ok() {
a.f = &b;
}
void allocate_in_branch_ok(bool b) {
std::unique_ptr<A>* FP_allocate_in_branch_ok(bool b) {
std::unique_ptr<A> a1;
std::unique_ptr<A> a2;
std::unique_ptr<A>* a3 = &a1;
@ -241,6 +241,8 @@ void allocate_in_branch_ok(bool b) {
a2 = std::make_unique<A>(*a1);
a3 = &a2;
} // current join makes a1 and a2 equal
return a3;
} // we get `use after destructor` for a1, after destructor call for a2
} // namespace use_after_destructor

Loading…
Cancel
Save