[LLVMbugs] [Bug 9455] New: Incorrectly reports "The left operand of '!=' is a garbage value"
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Mar 11 03:11:41 PST 2011
http://llvm.org/bugs/show_bug.cgi?id=9455
Summary: Incorrectly reports "The left operand of '!=' is a
garbage value"
Product: clang
Version: 2.9
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: boborbt at gmail.com
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=6309)
--> (http://llvm.org/bugs/attachment.cgi?id=6309)
A bare-bone c-file that shows the problem.
In the attached source, the analyzer incorrectly reports a potential garbage
value.
It seems that the analyzer gets confused by the combination of static
initialization of the char string:
char pattern[4] = "000";
and by the subsequent modification by the if statements:
if (fun(t-1)) {
pattern[0] = '1';
}
if (fun(t)) {
pattern[1] = '1';
}
if (fun(t+1)) {
pattern[2] = '1';
}
when the code reaches a loop that make simple checks over the string:
int i;
for( i=0; i<3; ++i ) {
if(pattern[i]!=fun2(i))
return 0;
}
the analyzer incorrectly thinks that pattern[i] is gargbage value. This cannot
be the case since all indices in 0..2 have been initialized to the character
'0'.
--
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