The question is quite old but I think another answer I got here. Even though if you plan to do a full build on gcc, you can give a try to clang compiler (e.g. for nightly builds in large projects). It worked quite well.
An example is the output when I tried accessing index 4 where the array size is declared as 4:
ex9.c:17:2: warning: array index 4 is past the end of the array (which contains
4 elements) [-Warray-bounds]
numbers[4] = 4;
^ ~
ex9.c:4:2: note: array 'numbers' declared here
int numbers[4] = {0};
^
Thanks
Kajal