[cfe-users] clang-analyzer doesn't check unreachable paths?
Anna Zaks
ganna at apple.com
Fri Nov 21 15:34:11 PST 2014
> On Nov 4, 2014, at 4:03 PM, Alex <cn1729 at yandex.com> wrote:
>
> 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?
This depends on the type of problem reported. For example, the analysis continues along the path on which a non-fatal failure (such as leak) has been reported. However, in most cases, we stop analyzing the path after a fatal failure.
> If yes, is there a way to ask for full coverage?
No.
> Thank you. - Alex
> _______________________________________________
> cfe-users mailing list
> cfe-users at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
More information about the cfe-users
mailing list