]> granicus.if.org Git - clang/commit
[analyzer] Fix for PR23790 : constrain return value of strcmp() rather than returning...
authorAnton Yartsev <anton.yartsev@gmail.com>
Thu, 19 May 2016 23:03:49 +0000 (23:03 +0000)
committerAnton Yartsev <anton.yartsev@gmail.com>
Thu, 19 May 2016 23:03:49 +0000 (23:03 +0000)
commit23d62c03a7d342acec33d43091e70d1b60ec5b0a
treeb082b24abe17c37b12c0f69da186111dd3734a6f
parent58d65b28b41e0151c9b7953e1de1dbaae151dbb6
[analyzer] Fix for PR23790 : constrain return value of strcmp() rather than returning a concrete value.

The function strcmp() can return any value, not just {-1,0,1} : "The strcmp(const char *s1, const char *s2) function returns an integer greater than, equal to, or less than zero, accordingly as the string pointed to by s1 is greater than, equal to, or less than the string pointed to by s2." [C11 7.24.4.2p3]
https://llvm.org/bugs/show_bug.cgi?id=23790
http://reviews.llvm.org/D16317

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@270154 91177308-0d34-0410-b5e6-96231b3b80d8
lib/StaticAnalyzer/Checkers/CStringChecker.cpp
test/Analysis/string.c