https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95279
--- Comment #16 from joseph at codesourcery dot com <joseph at codesourcery dot com> --- On Wed, 3 Jun 2020, pinskia at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95279 > > --- Comment #15 from Andrew Pinski <pinskia at gcc dot gnu.org> --- > (In reply to jos...@codesourcery.com from comment #14) > > I think it's invalid to refer to element (size_t)-1 of an array; that the > > actual integer value used has to be within the range of available array > > elements. > > But this case is: > (array + 1) + (size_t)-1 > > That is the question there. That doesn't make any difference. A reference to positive index n, regardless of where the pointer points within the underlying object, isn't valid unless all indexes 0, 1, 2, ..., n are valid.