[LLVMbugs] [Bug 12801] New: possibly spurious warning about garbage value
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri May 11 10:31:36 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=12801
Bug #: 12801
Summary: possibly spurious warning about garbage value
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: tjw at me.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 8537
--> http://llvm.org/bugs/attachment.cgi?id=8537
example
clang-sa warns about garbage values even if they are never used. This is
causing new spurious warnings in a third party library that we use, which had
previously built w/o these warnings.
In the attached example, the output argument pX of read_byte() is not written
to unless the fread succeeds. It then returns READ_OK and the caller checks for
this, only using (for some value of "using") the value of its local in this
case. The eventual output of read_short() won't be changed by this value being
garbage, even though some operations are done on it (the addition of the second
read byte).
I guess this might not be the case if overflow traps are on, but I'm not sure
if clang or the C spec says anything about this. Maybe this is mandated by the
spec.
For now, we'll rewrite the library code to be less "clever" anyway =)
clang version 3.2 (trunk 156620)
Target: x86_64-apple-darwin11.3.0
Thread model: posix
--
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