[Uninit][7/13] Add new tests

Reviewed By: jeremydubreil

Differential Revision: D10250168

fbshipit-source-id: 5e5983f04
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent 01f3f39760
commit 5679105c15

@ -20,3 +20,8 @@ int dereference_bad() {
int* p;
return *p;
}
void FN_self_assign() {
int x;
x = x;
}

@ -8,6 +8,7 @@ codetoanalyze/cpp/uninit/members.cpp, access_pointer_members_bad, 3, UNINITIALIZ
codetoanalyze/cpp/uninit/members.cpp, access_pointer_members_bad, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/members.cpp, access_pointer_members_bad, 5, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/struct.cpp, pass_basic_type_field_bad, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/struct.cpp, struct_partial_init_bad, 6, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/struct.cpp, struct_uninit_bad, 3, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/uninit.cpp, FP_no_warning_noreturn_callee_ok, 7, UNINITIALIZED_VALUE, no_bucket, ERROR, []
codetoanalyze/cpp/uninit/uninit.cpp, FP_pointer_param_void_star_ok, 4, UNINITIALIZED_VALUE, no_bucket, ERROR, []

@ -149,3 +149,13 @@ int foo() {
struct s t = not_a_constructor_but_returning_T();
return t.n;
}
short struct_partial_init_bad() {
struct {
int* a;
short* b;
} s;
s.a = 0;
short* p = s.b;
return *p;
}

@ -293,3 +293,40 @@ int condition_no_init_bad() {
}
return 0;
}
void call_to_fn_ptr_with_init_arg_good(void (*f)(int)) {
int a = 42;
f(a);
}
void FN_call_to_fn_ptr_with_uninit_arg_bad(void (*f)(int)) {
int a;
f(a);
}
void call_to_init_fn_ptr_good() {
void (*f)();
f = use_square_ok1;
f();
}
void call_to_init_fn_ptr2_good(bool nondet) {
void (*f)();
if (nondet)
f = use_square_ok1;
else
f = deref_magic_addr_ok;
f();
}
void FN_call_to_uninit_fn_ptr_bad() {
void (*f)();
f();
}
void FN_call_to_maybe_uninit_fn_ptr_bad(bool nondet) {
void (*f)();
if (nondet)
f = use_square_ok1;
f();
}

Loading…
Cancel
Save