https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97828
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |ASSIGNED Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org Last reconfirmed| |2020-11-16 Target Milestone|--- |10.3 --- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> --- Confirmed, your analysis makes sense to me. For the implementation bug, I guess it would be better to mirror how std::search_n updates __remainder and do __remainder = __count + 1 - (__first - __backtrack); right after the while loop.