https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86532

--- Comment #10 from Bernd Edlinger <bernd.edlinger at hotmail dot de> ---
(In reply to Richard Biener from comment #9)
> 
> I bet Martin would argue it's invalid ...
> 
> The standard specifies initializing char[3] with "121" is valid.  7.24.1/1
> specifies "if an array is accessed beyond the end of an object, the behavior
> is undefined" where it is not clear how "object" relates to "array".
> 
> The definition of "string" doesn't talk about abstract layout so to me
> doesn't rule out char str[1][5] or str[5][1].  It rules out struct { char c;
> char d; } because of allowed padding.

Yes, you win!
But I bet someone will assign a CVE for this optimization.

Reply via email to