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