[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #14 from mark at codesourcery dot com 2008-07-10 14:58 --- Subject: Re: [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall rguenther at suse dot de wrote: > Can the FE mark this array-access with TREE_NO_WARNING? Or is it not > in array_ref form? In general, the FE cannot do that; the array might have (say) 128-byte elements, but there will still only be (say) 8 bytes for the cookie. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #13 from rguenther at suse dot de 2008-07-10 14:07 --- Subject: Re: [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall On Thu, 10 Jul 2008, paolo dot carlini at oracle dot com wrote: > --- Comment #12 from paolo dot carlini at oracle dot com 2008-07-10 > 13:53 --- > The warning is bogus, for sure. The issue is how / where to fix it. Apparently > it comes from check_array_ref in tree-vrp.c, outside the C++ front-end indeed. > First thing, we should probably figure out what is exactly happening at -O2 vs > -O1 and study a bit the code around that check_array_ref call in the > debugger... Anyway, if we are coming to believe that the issue isn't a > front-end one, maybe Richard can help... Can the FE mark this array-access with TREE_NO_WARNING? Or is it not in array_ref form? Richard. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #12 from paolo dot carlini at oracle dot com 2008-07-10 13:53 --- The warning is bogus, for sure. The issue is how / where to fix it. Apparently it comes from check_array_ref in tree-vrp.c, outside the C++ front-end indeed. First thing, we should probably figure out what is exactly happening at -O2 vs -O1 and study a bit the code around that check_array_ref call in the debugger... Anyway, if we are coming to believe that the issue isn't a front-end one, maybe Richard can help... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #11 from chris dot fairles at gmail dot com 2008-07-10 13:41 --- On x64_64, alignof(smart_ptr) == sizeof(size_t) == 8. So then the size of the array is stored in the 8 bytes prior to the address of the returned pointer from new[]. In the delete[] call, its offsetting the returned address by 8 which is correct no? So isn't this a bogus warning? Chris -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #10 from paolo dot carlini at oracle dot com 2008-07-10 09:57 --- Thanks Mark, frankly I didn't know about "cookies". By the way, naively, the fact that the warning is emitted only for -O2 doesn't indicate to me a pure front-end issue... -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[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
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
--- Comment #8 from paolo dot carlini at oracle dot com 2008-07-09 22:49 --- Mark, could you possibly comment on this PR? With some good hints I could even try to work on it... -- paolo dot carlini at oracle dot com changed: What|Removed |Added CC||mark at codesourcery dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
-- jsm28 at gcc dot gnu dot org changed: What|Removed |Added Target Milestone|--- |4.4.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633
[Bug c++/36633] [4.4 regression] warning "array subscript is below array bounds" on delete [] with -O2, -Wall
-- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2008-06-25 21:24:20 date|| Summary|warning "array subscript is |[4.4 regression] warning |below array bounds" on |"array subscript is below |delete [] with -O2, -Wall |array bounds" on delete [] ||with -O2, -Wall http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36633