https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67279
--- Comment #3 from Vittorio Zecca <zeccav at gmail dot com> --- The following code has UB at lines 4 and 5 but compiles with -fsanitize=undefined int main() { int test[1],t; t=test[1]; return test[1]; } Its execution it delivers four runtime errors from the sanitizer and I am happy with that ps.c:4:7: runtime error: index 1 out of bounds for type 'int [1]' ps.c:4:2: runtime error: load of address 0x7ffcb21195f4 with insufficient space for an object of type 'int' 0x7ffcb21195f4: note: pointer points here e0 96 11 b2 fc 7f 00 00 00 00 00 00 00 00 00 00 70 07 40 00 00 00 00 00 e0 ff a1 0d 39 00 00 00 ^ ps.c:5:12: runtime error: index 1 out of bounds for type 'int [1]' ps.c:5:8: runtime error: load of address 0x7ffcb21195f4 with insufficient space for an object of type 'int' 0x7ffcb21195f4: note: pointer points here e0 96 11 b2 fc 7f 00 00 00 00 00 00 fc 7f 00 00 70 07 40 00 00 00 00 00 e0 ff a1 0d 39 00 00 00 In short: I like to see gcc -fsanitize=undefined to compile codes it compiles without sanitation