[cfe-users] clang-analyzer doesn't check unreachable paths?

Alex cn1729 at yandex.com
Tue Nov 4 16:03:32 PST 2014


Hi everyone. "clang --analyze" for the snippet below only reports null pointer dereference:

int main() {
    *(int*) 0;
    1 / 0;
}

Here it only reports division by zero:

int main() {
    1 / 0;
    *(int*) 0;
}

And here it reports both:

int main(int argc, char* argv[]) {
    argc > 2 ? *(int*) 0 : 1 / 0;
}

Does it mean that paths unreachable due to fatal errors are not checked? If yes, is there a way to ask for full coverage? Thank you. - Alex



More information about the cfe-users mailing list