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

--- Comment #4 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Xi Ruoyao from comment #3)
> This invalid bug report is actually not related to flexible array member. 
> It's just invoking an undefined behavior.  With -fsanitize=undefined
> -fno-sanitize-recover:

Note that the "Enter Bug" page has a red banner referring to 
https://gcc.gnu.org/bugs/, and this page says:

If compiling with -fsanitize=undefined produces any run-time errors, then your
code is probably not correct.

> In C even
> 
> int a[1];
> return a[114514];
> 
> will compile.

Correction: technically it should be "may compile".  The compiler is also
allowed to reject programs which *always* invokes an undefined behavior.  But
AFAIK no C compiler really rejects code because of an OOB array access as at
now.

Reply via email to