The problem is that it doesn't use them much, and gets rid of them as soon as possible:
int a[5] = {1, 2, 3, 4, 5, 6};
printf("%d\n", a[8]);
in clang, this warns, by default, on both misuse sites "excess elements in array initializer" and "array index is past the end of the array". Which is good.However things go downhill as soon as you pass the arrays downstack:
#include <stdio.h>
static void foo(int *a) {
printf("%d\n", a[8]);
}
static void bar(int a[]){
printf("%d\n", a[8]);
}
static void qux(int a[6]){
printf("%d\n", a[8]);
}
int main() {
int a[5] = {1, 2, 3, 4, 5};
foo(a);
bar(a);
qux(a);
}
no warning anywhere, even under "-Wall -Weverything".