On Fri, Mar 20, 2015 at 11:15:30AM -0400, Jason Merrill wrote: > On 03/20/2015 11:11 AM, Jakub Jelinek wrote: > >>&s[3] is the address of the terminal \0. > > > >Yeah, sure. But the above testcase does &s[4], which is out of bounds > >arithmetics > > But since &s[3] is the address of an element of the array (the NUL), &s[4] > is one-past-the-end, which is fine. &s[5] would be out of bounds.
Ashamed... Obviously I meant if we should diagnose *(&s[5] - 2). clang++ does. > Agreed. And I still think it makes sense to fix this as part of this patch. Yes. Jakub