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: [email protected]
ReportedBy: [email protected]
CC: [email protected]
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs