> What does VMT mean?
Variable modified types, they were introduces with VLAs (variable length arrays) in c99. C11 made both optional, and C2x mandates only VMTs.
About gcc ignoring it: gcc doesn't check array bounds at all, even `int x[2]; x[9] = 1;` doesn't produce a warning.
Oddly, it does catch it for the static example posted by someone else, but that is the only place where it catches it.
You need to use UBSan, then you get the bounds checking in GCC. I added this in 2015.
#define ARR_LEN(a) (sizeof (a) / sizeof (a))
int main(void) { int a[5] = {0, 1, 2, 3, 4};
}I had no idea this was possible in C. It is unfortunate that GCC seems to ignore this information. Clang on the other hand uses it.