https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99752
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> --- Your example is an infinite loop because you're asking for the last occurrence of e in an infinite range. There is no end of an infinite range.