MinGW doesn't have the macros S_IRGRP, S_IWGRP, S_IROTH, or S_IWOTH that are used in unix.c. It also does not have mkstemp(). There is a mkstemps() in libiberty, but it does not appear to be usable for this: <http://gcc.gnu.org/ml/gcc/2004-09/msg00949.html>.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg01171.html>. The identifiers are defined if not, and temporary files are created with mktemp() if mkstemp() is not availible.
Revised patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02417.html>.
Revised patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-10/msg02422.html> (honest).
Fixed.