https://gcc.gnu.org/bugzilla/show_bug.cgi?id=35341
Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Known to work| |7.5.0 Resolution|--- |FIXED --- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- I think this works as expected. You can always use #pragma GCC unroll N to override GCCs heuristics here. As said, with -O3 we now completely peel the loop.