I don't think bounds checking can be done at compile-time, especially in C/C++.
char x[4];
printf("%c", x[4]);
That's pretty easy to detect.We can look at the example given above and clearly know/prove that the access is out of bounds. ie: a C compiler could emit a diagnostic (or decide it's undefined behavior and treat it as unreachable).
There aren't any bounds checks above to eliminate.