This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]