https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80520
--- Comment #3 from krister.walfridsson at gmail dot com --- You can see the issue in the generated code with int foo(std::mt19937 &gen) { std::uniform_int_distribution<int> dist(0,99); return dist(gen); } too. I.e. it is not just an artifact of the uninteresting use in the benchmarking loop.