It's not a "valid statement" in that its behavior is undefined. However, it's not a constraint violation, and thus the compiler is not obligated (and not necessarily able) to tell you at compile-time that it's wrong. To know that it's wrong, the compiler would have to track what it points to, and although that's easy in your particular example, in general, it's not even possible.
When (at runtime) you perform the addition bytes+10000
(implicit in the expression bytes[10000]
), the resulting behavior is undefined. Undefined behavior means all bets are off as to what your program does. There is no obligation for it to inform you that anything went wrong, nor to behave as you might hope it would.