https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112312
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-10-31 Ever confirmed|0 |1 Summary|-O3 produces worse code |-O3 produces worse code |than -O2 for |than -O2 for |std::ranges::lower_bound in |std::ranges::lower_bound in |some cases, not removing an |some cases, not marking a |empty loop |loop as finite Status|UNCONFIRMED |NEW --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Confirmed. So further difference is the loop seems not to be marked as finite while with -O2 (or the non-lamdba version) is. Someone will need to figure out if and where we lose the idea of the finite loopness.