[LLVMbugs] [Bug 10608] New: False positive - inequality constraints ignored
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon Aug 8 07:15:35 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10608
Summary: False positive - inequality constraints ignored
Product: new-bugs
Version: 2.9
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: clang-bugzilla at macspice.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=7036)
--> (http://llvm.org/bugs/attachment.cgi?id=7036)
A minimal test case.
In the attached file the value of the integer 'order' is constrained by test
for an inequality. However, this information is apparently not used by clang,
as a result the attached demo gives a false positive.
This problem occurs commonly when a loop is exited using a condition like 'if
(i > j) break;'
Charles
$ /Developer/usr/bin/clang -v --analyze
Apple clang version 2.0 (tags/Apple/clang-139) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
$ /Developer/usr/bin/clang -v --analyze
/Users/cdhw/Code/clang_bugs/clang_bugs/main.c -o
clang: error: argument to '-o' is missing (expected 1 value)
Apple clang version 2.0 (tags/Apple/clang-139) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
$ /Developer/usr/bin/clang -v --analyze
/Users/cdhw/Code/clang_bugs/clang_bugs/main.c -o foo.html
Apple clang version 2.0 (tags/Apple/clang-139) (based on LLVM 2.9svn)
Target: x86_64-apple-darwin10
Thread model: posix
"/Developer/usr/bin/clang" -cc1 -triple x86_64-apple-darwin10.0.0 -analyze
-disable-free -disable-llvm-verifier -main-file-name main.c
-analyzer-store=region -analyzer-opt-analyze-nested-blocks
-analyzer-check-dead-stores -analyzer-check-objc-mem -analyzer-eagerly-assume
-analyzer-check-objc-methodsigs -analyzer-check-objc-unused-ivars
-analyzer-check-idempotent-operations -analyzer-output plist -w -pic-level 1
-mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2
-target-linker-version 123.2 -v -resource-dir
/Developer/usr/bin/../lib/clang/2.0 -ferror-limit 19 -fmessage-length 80
-stack-protector 1 -fblocks -fdiagnostics-show-option -fcolor-diagnostics -o
foo.html -x c /Users/cdhw/Code/clang_bugs/clang_bugs/main.c
clang -cc1 version 2.0 based upon llvm 2.9svn hosted on x86_64-apple-darwin10
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Developer/usr/bin/../lib/clang/2.0/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
/Users/X/Code/clang_bugs/clang_bugs/main.c:17:14: warning: Assigned value is
garbage or undefined
t[i] = s[i];
^ ~~~~
1 warning generated.
$
--
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