https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99101
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If there are EH edges, doesn't it fit then the -ffinite-loops description: '-ffinite-loops' Assume that a loop with an exit will eventually take the exit and not loop indefinitely. This allows the compiler to remove loops that otherwise have no side-effects, not considering eventual endless looping as such. This option is enabled by default at '-O2' for C++ with -std=c++11 or higher. ? EH is an exit as well...