https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105506
--- Comment #7 from Brecht Sanders <brechtsanders at users dot sourceforge.net> --- Thank you for sharing your insights. I can confirm building with CFLAGS="-D__USE_MINGW_ACCESS" works. So I guess the question that remains is: Where is -D__USE_MINGW_ACCES missing in the configuration of GCC 12? It would seem to me the answer lies in code added since GCC 11 that contains access()/X_OK.