[LLVMbugs] [Bug 7946] New: false positive - divide by zero

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 19 18:05:26 PDT 2010


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

           Summary: false positive - divide by zero
           Product: clang
           Version: unspecified
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
        AssignedTo: kremenek at apple.com
        ReportedBy: LetterRip at gmail.com
                CC: llvmbugs at cs.uiuc.edu


This is a simplified version of our code - if tot is zero it returns, so the
devide by zero never happens.  Tested using checker-247

static void ui_litem_layout_split(uiLayout *litem)
{
    uiItem *item;
    int tot = 0;
        float test = 0.0f;

    for(item=litem->items.first; item; item=item->next)
        tot++;

    if(tot == 0)
        return;

    test = 1/(tot-1); //complaint of divide by zero
}

-- 
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