[LLVMbugs] [Bug 23790] New: CStringChecker assumes strcmp only returns -1, 0, or 1 when it can return any integer value

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Jun 8 17:32:53 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23790

            Bug ID: 23790
           Summary: CStringChecker assumes strcmp only returns -1, 0, or 1
                    when it can return any integer value
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: rtrieu at google.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

test/Analysis/string.c

703     void strcmp_1() {
704      char *x = "234";
705      char *y = "123";
706      clang_analyzer_eval(strcmp(x, y) == 1); // expected-warning{{TRUE}}
707    }

This is from the test for CStringChecker.  The function strcmp can return any
positive value in this case.  It is not constrained to returning 1.  The true
evaluation here is incorrect.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150609/74447ea1/attachment.html>


More information about the llvm-bugs mailing list