https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118248
--- Comment #24 from Jeffrey A. Law <law at gcc dot gnu.org> --- The first approach looks better to me. I might suggest refactoring a bit by precomputing how many iterations of the loop there will be and using that for the outer control, allocation and the inner for controls. Those are all closely related but you have to do a bit of mental algebra to get there. But I could live with it as-is too.