https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65786
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|critical |normal --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I think this is undefined code as you are std::max returns a reference so you are returning a reference to a temp variable which went out of scope.