https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102769
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- It is still UB, the b = &h; happens inside of the scope, then the scope is left and on a next iteration rentered again and *b dereferenced. I don't think C/C++ have anything that would special case {}s around body of the loop, though in most versions of the languages there is an extra for scope around it.