[LLVMbugs] [Bug 13919] New: static analyzer false positive when reinterpreting buffer as char*
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Sep 25 13:49:06 PDT 2012
http://llvm.org/bugs/show_bug.cgi?id=13919
Bug #: 13919
Summary: static analyzer false positive when reinterpreting
buffer as char*
Product: new-bugs
Version: trunk
Platform: Macintosh
OS/Version: All
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
AssignedTo: unassignedbugs at nondot.org
ReportedBy: sean at rogue-research.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
----------------
#include <stdint.h>
int main (void)
{
uint16_t bar[2] = {0, 0}; // 4 bytes
char* foo = (char*)bar;
int x = foo[3]; // warning here
(void)x;
return 0;
}
----------------
$ clang --version
clang version 3.2 (trunk 164470)
$ clang -Weverything test.c
(no output)
$ clang --analyze test.c
test.c:7:2: warning: Assigned value is garbage or undefined
int x = foo[3];
^ ~~~~~~
1 warning generated.
This warning is a false positive.
--
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