This loop is a classic UB trap that optimizers exploit. Why can a compiler legally turn it into an infinite loop or remove the bound check entirely?
void scan(int* a, int n) {
for (int i = 0; i <= n; ++i) // note: <= and n could be INT_MAX
a[i] = 0;
}