|
|
|
|
|
by balnaphone
753 days ago
|
|
Perhaps that is inexcusable. GNU gcc version 13.2.0 (with -O2, as documented) does report a problem. $ cat tst.c
int main () {
int x[10];
return *(x+20);
}
$ gcc -Wall -O2 tst.c
tst.c: In function ‘main’:
tst.c:3:10: warning: array subscript 20 is outside array bounds of ‘int[10]’ [-Warray-bounds=]
3 | return *(x+20);
| ^~~~~~~
tst.c:2:7: note: at offset 80 into object ‘x’ of size 40
2 | int x[10];
| ^
|
|