https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119693
Harald van Dijk <harald at gigawatt dot nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |harald at gigawatt dot nl --- Comment #4 from Harald van Dijk <harald at gigawatt dot nl> --- (In reply to Andrew Pinski from comment #3) > >so I think you're allowed to have bigger objects as long as you don't do > >pointer arithmetic on them. > > Right but strlen could be defined as `char *start = arg; char *end = start; > while (!*end) end++; return end - start;` . If end - start has undefined behaviour for a well-defined call to strlen() (keeping in mind that strlen() is not specified in terms of pointer arithmetic), then doesn't that make it invalid for strlen() to be defined in that way?