[Bug c/68065] Size calculations for VLAs can overflow
joseph at codesourcery dot com
gcc-bugzilla@gcc.gnu.org
Tue Oct 27 17:09:00 GMT 2015
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68065
--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I think it's undefined at the point where a type exceeds the limit on the
size of an object (half the address space minus one byte), whether or not
sizeof is used or any object with that type is constructed - that is, as
soon as the language semantics involve evaluation of the array sizes for
the VLA type in question. (If the sizes are neither evaluated nor
required, e.g. sizeof (int (*)[size]), or when replaced by [*] at function
prototype scope, I don't consider that undefined; if required but not
evaluated, as in certain obscure cases of conditional expressions, that's
a different case of undefined behavior.)
More information about the Gcc-bugs
mailing list