Adding false negative tests for future work.

This commit is contained in:
Benjamin Rodes
2024-02-15 09:43:26 -05:00
parent 5c508553f3
commit caf2ee27fa
2 changed files with 53 additions and 31 deletions

View File

@@ -246,4 +246,24 @@ void pointer_arithmetic_test_on_bad_string(){
const char *const *p = &hello;
printf(hello); // BAD
}
}
}
struct struct1 {
char *non_const;
const char* const_member = "TEST";
char * const_member2 = "TEST";
struct struct2{
char *nested_non_const;
const char* nested_const_member = "TEST";
char * nested_const_member2 = "TEST";
} nested;
};
int test_uncalled_func_with_struct_param(struct struct1 *s) {
printf(s->non_const); // BAD [FALSE NEGATIVE]
printf(s->const_member); // GOOD
printf(s->const_member2); // GOOD
printf(s->nested.nested_non_const); // BAD [FALSE NEGATIVE]
printf(s->nested.nested_const_member); // GOOD
printf(s->nested.nested_const_member2); // GOOD
}