https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66936
--- Comment #10 from Keith Marshall <keith.marshall at mailinator dot com> --- (In reply to Andrew Pinski from comment #9) > Well it is a libgfortran bug yes. Which, being pedantic, makes it a GCC bug, because libgfortran is a component of GCC. > What we could do add to io/unix.c: > #if MINGW && !defined(S_IRWXG) > #define S_IRWXG 0 > #endif > #if MINGW && !defined(S_IRWXO) > #define S_IRWXO 0 > #endif > > And that will allow it to work correctly. Conceptually, yes; you'd actually need to test on __MINGW32__, or maybe even more generically on _WIN32, rather than on (nonexistent) MINGW. However, that seems every bit as much of a kludge as my own work-around. Realistically, calling umask() in this context on native windows would seem to be completely redundant anyway; I can't see how it will actually achieve anything, since all it will do will be to reproduce the already existing state, at the time of the call.