https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68547
Mikhail Maltsev <miyuki at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |miyuki at gcc dot gnu.org --- Comment #1 from Mikhail Maltsev <miyuki at gcc dot gnu.org> --- You invoke undefined behavior (out-of-bounds array access): $ g++ -fsanitize=undefined ./test.cc $ ./a.out DEL element[1]=200 volatile ./test.cc:17:57: runtime error: index 3 out of bounds for type 'unsigned int [3]' ./test.cc:17:57: runtime error: load of address 0x000000601a3c with insufficient space for an object of type 'unsigned int' 0x000000601a3c: note: pointer points here 2c 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ^ DEL element[1]=200 last_element_index=2 (should be 2) volatile DEL element[1]=200 ./test.cc:26:57: runtime error: index 3 out of bounds for type 'unsigned int [3]' ./test.cc:26:57: runtime error: load of address 0x000000601a3c with insufficient space for an object of type 'unsigned int' 0x000000601a3c: note: pointer points here 2c 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00