https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104635
--- Comment #10 from Jonathan Wakely <redi at gcc dot gnu.org> --- (In reply to Szüllő Ádám from comment #8) > Yes, the code as a whole is invalid. > But for(int i=0; i<4; i++) is well defined. No, that's not how undefined behaviour works. It isn't bounded or localised to a specific part of the program.