https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82229
--- Comment #19 from krzysio.kurek at wp dot pl --- I'm sorry if it's not clear, English isn't my native language. So to reiterate. The normal, unoptimized path is: World::update() simulates world which uses Random::get() to generate a random number. Random::get() calls std::uniform_int_distribution, which then calls std::mersenne_twister_engine(). And this is what GCC7 uses. Now GCC6 with LTO manages to optimize the path by: Calling Random::get() only once per frame. Omitting std::uniform_int_distribution, calling std::mersenne_twister_engine() instead every time a random number is needed.