Drop Windows entirely
Windows is proprietary commercial spy poisoned software. You can't to build solid software for windows without closed source compilers produced by M$. Every piece of software like MinGW (includes port of GCC) lacks of many closed, patented part of used run-time code from Visual Studio, which strongly need to produce correct code. It's especially true for C++ code, but valid for C code, where it lacks of some features. See #13443 (moved) for example for C++ code or #10186 (moved) for lack of stack tracing for code compiled by GCC.