> Conclusion: The problem was specific to Windows x64 builds.
> Then I tried a Release build with GCC (MinGW), and I successfully reproduced the bug.
GCC (MinGW) is probably the least battle tested of the major C++ compilers on Windows. The vast majority of commercial software on Windows is built with MSVC. Google builds Chrome with Clang. GCC on Windows doesn’t have nearly the same number of (paid) eyeballs looking for problems.
The chances of finding compiler bugs go up if you use less widely used compilers on a platform.