[Bug c++/80093] missed optimization opportunity with std::uniform_int_distribution
trashyankes at wp dot pl
gcc-bugzilla@gcc.gnu.org
Thu Mar 23 21:45:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80093
--- Comment #2 from trashyankes at wp dot pl ---
```
#include <random>
int foo (std::mt19937* x)
{
std::uniform_int_distribution<int> k(0, 99);
for (auto i = 0; i < 1'000'000'000; ++i)
{
std::uniform_int_distribution<int> y(0, 99);
volatile auto r = k(*x, k.param()); //change any of `k` to `y` simplify
code
}
}
```
This `operator()` do not use any members fields of `k` directly, therefore `y`
should give exactly same results but it isn't. This function depends on `k`
even if do not need to do this.
More information about the Gcc-bugs
mailing list