[LLVMbugs] [Bug 18299] New: False positive when aliasing structure
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Dec 20 22:12:37 PST 2013
http://llvm.org/bugs/show_bug.cgi?id=18299
Bug ID: 18299
Summary: False positive when aliasing structure
Product: clang
Version: unspecified
Hardware: Macintosh
OS: MacOS X
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: carl at lytro.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
I've attached a complete test case, but the simple breakdown is that this
function:
int f(void)
{
struct { int i; } s = { 0 };
char *c = (char *)&s;
return c[1];
}
Yields a static analysis warning saying:
example.c:6:5: warning: Undefined or garbage value returned to caller
return c[1];
^~~~~~~~~~~
1 warning generated.
Which, as far as I know, it shouldn't. Changing 'struct' to 'union' doesn't
give the warning, nor does removing the struct entirely and just using 'int i'
directly.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20131221/c543dfe7/attachment.html>
More information about the llvm-bugs
mailing list