[LLVMbugs] [Bug 2306] New: CHECKER: path sensitivity

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Sat May 10 02:18:04 PDT 2008


http://llvm.org/bugs/show_bug.cgi?id=2306

           Summary: CHECKER: path sensitivity
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Semantic Analyzer
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: edwintorok at gmail.com
                CC: llvmbugs at cs.uiuc.edu


Created an attachment (id=1629)
 --> (http://llvm.org/bugs/attachment.cgi?id=1629)
checker html report

Using SVN r50942:

/home/edwin/llvm-svn/llvm/tools/clang/utils/ccc-analyzer -c path_sens.c
path_sens.c
ANALYZE: path_sens.c foo
path_sens.c:10:11: warning: [CHECKER] Dereference of null pointer.
                return *bar;
                        ^~~
1 diagnostic generated.

int foo(int left, int right)
{
        int x=5;
        int *bar = 0;
        while(left<=right) {
                left++;
                bar = &x;
        }
        if(left<=right) {
                return *bar;
        }
        return 0;
}

See the attached html report, it says that the while() condition is false, and
then the if() condition  is true.
That can't happen, after the while (left<=right) is always false, hence the if
is never entered.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list