Files
codeql/cpp/ql/test/query-tests/jsf/4.24 Control Flow Structures/AV Rule 186/test.c
2019-04-10 18:08:10 +01:00

39 lines
427 B
C

int x = 0;
void called1()
{
x++;
}
void called2()
{
x++;
}
void not_called()
{
x++; // BAD: unreachable
}
int main(int argc, const char* argv[])
{
void (*fun_ptr)() = &called2;
called1();
called2();
if (argc > 4)
{
x++;
while (1) {
x++;
}
x++; // BAD: unreachable
} else if (argc > 4) {
x++; // BAD: unreachable [NOT DETECTED]
} else if (argc > 5) {
x++; // BAD: unreachable [NOT DETECTED]
}
}