> What happens if you don't use -D_FORTIFY_SOURCE= at all? I have no problems when not using -D_FORTIFY_SOURCE. It's set to 2 by default in the MSYS2 builds, I figured lowering it to 1 might work better but neither seem to work. > I see nothing in these issues that would point out some upstream > problem. The issues are all related to the Emacs builds produced by > the MSYS2 folks. So I think the initial investigation should be > theirs, until they identify the code in Emacs which misbehaves. I understand. I'll reach out to see how they want to proceed on their side. I've also just noticed that the -D_FORTIFY_SOURCE option seems to have been a rather recent addition to the MSYS2 build options and it seems like this was only recently even made possible. And the last successful MSYS2 build of Emacs was before that change. > Which version of GCC is this, btw? If it's the latest GCC 13, did you > try downgrading to GCC 12? It's GCC 13.1, yes, I haven't tested GCC 12. I don't know how easy it is to downgrade GCC on MSYS2 though, I assume there's a lot of dependencies that can go wrong. > FWIW, Emacs 28 and 29 (and also Emacs 30) builds fine for me with > MinGW, both with and without native-compilation, but I don't use > _FORTIFY_SOURCE (and don't plan on using it any time soon). This makes me wonder if GCC 13.1 Emacs builds with _FORTIFY_SOURCE are working fine in other operating systems? It's not something I can easily test, however.