https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229
--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Does -fno-threadsafe-statics help here? Though that should not make a difference here as GCC 6 defaults to the same as GCC 7 in this area. Also does moving "static Random r;" outside of Random::get() help?