I'm confused about making a decision.
For example, when I wrote a code 'test.c' like this.
int main(void){ int b = 2; int c = 0; int d = b/c; printf("d: %d\n", d); return 0; } And then, I typed the command clang --analyze test.c then the statement warning: Division by zero [core.DivideZero]" appeared
After that, I typed the command clang test.c. Then no warning comes out. However, when I run this program, error Floating point exception(core dumped) comes out.
In this case, which is the right one? is it a true-positive or false positive? Can someone explain it to me?
clang test.cwith the source code shown in the problem does not result in no warning. it results in a warning aboutprintfnot being declared, since<stdio.h>was not included. The source code in the question is not the code you compiled. When asking questions like this, always include a correct minimal reproducible example that includes code that is just enough to demonstrate the problem but that is complete, meaning a reader should be able to paste exactly the source code you show into a file and compile it to reproduce the problem, with no changes or additions.b/0so at least they check integer constant expressions. They don't have to do that either.