https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111319
--- Comment #4 from Shaohua Li <shaohua.li at inf dot ethz.ch> --- (In reply to Xi Ruoyao from comment #3) > Please try not to create more reports with "not sure if there is UB" esp. > this UB should be obvious, and it's also detectable with > -fsanitize=undefined: > > t.c:13:7: runtime error: load of address 0x7ffd53183020 with insufficient > space for an object of type 'int' > 0x7ffd53183020: note: pointer points here > 2a 56 00 00 01 00 00 00 00 00 00 00 00 14 1a ed ca 50 d4 0e 00 00 00 00 > 00 00 00 00 98 31 18 53 > ^ UBSan only detects it at -O2 level and I used `-O0 -fsanitize=address,undefined` to detect if there is any report. https://godbolt.org/z/zvcG8znvT