mardi 11 janvier 2022

Weird stack buffer overrun crash using std::uniform_int_distribution

I am using CMake with "Visual Studio 17 2022" Generator in my desktop to compile this code. Whenever I put this code, it works and then crashes with stack buffer overrun 0xc0000409 after the containing function returns, only in the Release build. The Debug build works well, which is similar to the situation this answer is describing.

std::random_device rd;
std::default_random_engine eng(rd());
std::uniform_int_distribution<uint64_t> dis(std::numeric_limits<uint64_t>::min(), std::numeric_limits<uint64_t>::max());
dis(eng);

The exactly same code containing this works well in Google colab(using g++ 11). How can I fix this?




Aucun commentaire:

Enregistrer un commentaire