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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to