<div>As below, these problems can be found be Coverity. But no BUGS were reported useing scan-build;(</div><div>Is the reason that I did not choose the right checkers?</div><div>Hers is my command line:</div><div><div>scan-build --use-analyzer=/usr/local/bin/clang -enable-checker llvm.Conventions -enable-checker alpha.core.BoolAssignment -enable-checker alpha.core.CastSize -enable-checke</div><div>    r alpha.core.CastToStruct -enable-checker alpha.core.FixedAddr -enable-checker alpha.core.IdenticalExpr -enable-checker alpha.core.PointerArithm -enable-checker alpha.core.</div><div>    PointerSub -enable-checker alpha.core.SizeofPtr -enable-checker alpha.cplusplus.NewDeleteLeaks -enable-checker alpha.cplusplus.VirtualCall -enable-checker alpha.deadcode.Id</div><div>    empotentOperations -enable-checker alpha.deadcode.UnreachableCode -enable-checker alpha.security.ArrayBound -enable-checker alpha.security.ArrayBoundV2 -enable-checker alph</div><div>    a.security.MallocOverflow -enable-checker alpha.security.ReturnPtrRange -enable-checker alpha.security.taint.TaintPropagation -enable-checker alpha.unix.Chroot -enable-chec</div><div>    ker alpha.unix.MallocWithAnnotations -enable-checker alpha.unix.PthreadLock -enable-checker alpha.unix.SimpleStream -enable-checker alpha.unix.Stream -enable-checker alpha.</div><div>    unix.cstring.BufferOverlap -enable-checker alpha.unix.cstring.NotNullTerminated -enable-checker alpha.unix.cstring.OutOfBounds -enable-checker security.FloatLoopCounter -en</div><div>    able-checker security.insecureAPI.rand -enable-checker security.insecureAPI.strcpy clang -c test2.c</div></div><div><br></div><div>----------------------------------------------------------------------</div><div>1.case without break</div><div>e.g.</div><div>int test(const int n) {</div><div>    int ret = 0;</div><div>    switch(n) {</div><div>    case 1:</div><div>        ret = 1;</div><div>        break;</div><div>    case 2:</div><div>        ret = 2; // this case branch has no 'break' statement.(coverity gived a warning here, but Clang didn't)</div><div>    default:</div><div>        break;</div><div>    }</div><div>    return ret;</div><div>}</div><div>----------------------------------------------------------------------</div><div>2.Dead code like below</div><div>#define MAX_NUM 10</div><div>void test(const int n) {</div><div>    if(n >= MAX_NUM && n < MAX_NUM) {</div><div>        printf("yes\n"); // this code will never be executed!(coverity gived a warning here, but Clang didn't)</div><div>    }</div><div>}</div><div>----------------------------------------------------------------------</div><div>3.NULL-Pointer reference like below</div><div>typedef struct {</div><div>    int age;</div><div>    int sex;</div><div>}Person;</div><div><br></div><div>Person *one_person(char flag)</div><div>{</div><div>    static Person p = {0, 0};</div><div>    if(flag == 1) {</div><div>        return &p;</div><div>    }</div><div>    return NULL;</div><div>}</div><div><br></div><div>void test()</div><div>{</div><div>    Person *p = on_person(0); </div><div>    p->age = 24; // NULL-Pointer reference(coverity gived a warning here, but Clang didn't)</div><div>    p->sex = 0;</div><div>}</div>