https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85091
--- Comment #17 from Mathieu Malaterre <mathieu.malaterre at gmail dot com> --- Here is what I did over here: # debootstrap --arch amd64 sid /srv/chroot/sid-amd64 http://httpredir.debian.org/debian # mount -t proc proc /srv/chroot/sid-amd64/proc # chroot /srv/chroot/sid-amd64 apt install g++-mingw-w64-i686 Then (https://wiki.debian.org/AutomaticDebugPackages): # apt install g++-mingw-w64-i686-dbgsym And eventually ran valgrind on both: # valgrind --trace-children=yes i686-w64-mingw32-g++ -c -std=c++17 -O2 -Wnonnull -Woverloaded-virtual -v tmp1/16795.cpp -o warn.o >& /tmp/ok # valgrind --trace-children=yes i686-w64-mingw32-g++ -c -std=c++17 -O2 -Wnonnull -Woverloaded-virtual -v 16795.cpp -o warn.o >& /tmp/notok The valgrind output seems rather different, so I suspect the issue is indeed an invalid read/write which should be somewhere in the diff of ok vs notok.