[cfe-dev] -Warray-bounds false positive?
Sean McBride
sean at rogue-research.com
Thu Aug 25 14:00:08 PDT 2011
Hi all,
I'm not enough of a language lawyer to be 100% sure, but:
-----
int main (void)
{
double foo[4096];
((char *)(foo))[(sizeof(foo)-1)] = '\0';
return 0;
}
-----
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';
^ ~~~~~~~~~~~~~
Is a false positive, right?
This is with clang version 3.0 (trunk 138577).
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng sean at rogue-research.com
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
More information about the cfe-dev
mailing list