[LLVMbugs] [Bug 10771] New: -Warray-bounds false positive when a cast is involved
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Fri Aug 26 07:08:38 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10771
Summary: -Warray-bounds false positive when a cast is involved
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: sean at rogue-research.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
Consider this C++:
int main (void)
{
double foo[4096];
((char *)(foo))[(sizeof(foo)-1)] = '\0';
return 0;
}
It outputs:
test.cp:4:12: warning: array index of '32767' indexes past the end of an array
(that contains 4096 elements) [-Warray-bounds]
((char *)(foo))[(sizeof(foo)-1)] = '\0';
^ ~~~~~~~~~~~~~
It's a false positive. Note the cast to char*.
This is with clang version 3.0 (trunk 138577).
--
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