[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
mark at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Thu Jul 10 03:43:00 GMT 2008
------- Comment #9 from mark at codesourcery dot com 2008-07-10 03:42 -------
Subject: Re: [4.4 regression] warning "array subscript is
below array bounds" on delete [] with -O2, -Wall
paolo dot carlini at oracle dot com wrote:
> Mark, could you possibly comment on this PR? With some good hints I could even
> try to work on it...
I don't see that the C++ front-end is doing anything obviously wrong
here. The cast to (long unsigned int *) is coming from the presence of
the array "cookie". When we allocate an array, we allocate a few extra
bytes and scribble the length of the array into that extra space. Then,
when the user does "delete[]" we know how many array elements there are,
so we can run all the destructors. See:
http://www.codesourcery.com/public/cxx-abi/abi.html#array-cookies
Thanks,
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
More information about the Gcc-bugs
mailing list