void strlen_subregion() { struct two_strings { char a[2], b[2]; }; extern void use_two_strings(struct two_strings *); struct two_strings z; use_two_strings(&z); size_t a = strlen(z.a); z.b[0] = 5; size_t b = strlen(z.a); if (a == 0) clang_analyzer_eval(b == 0); // expected-warning{{TRUE}} use_two_strings(&z); size_t c = strlen(z.a); if (a == 0) clang_analyzer_eval(c == 0); // expected-warning{{UNKNOWN}} }
void strlen_subregion() { struct two_strings { char a[2], b[2]; }; extern void use_two_strings(struct two_strings *); struct two_strings z; use_two_strings(&z); size_t a = strlen(z.a); z.b[0] = 5; size_t b = strlen(z.a); if (a == 0 && b != 0) (void)*(char*)0; // expected-warning{{never executed}} use_two_strings(&z); size_t c = strlen(z.a); if (a == 0 && c != 0) (void)*(char*)0; // expected-warning{{null}} }