[cfe-dev] -Warray-bounds false positive?
Jordy Rose
jediknil at belkadan.com
Thu Aug 25 14:22:23 PDT 2011
On Aug 25, 2011, at 14:00, Sean McBride wrote:
> 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?
Yes. File a bug? :-)
More information about the cfe-dev
mailing list