https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62215
Bug ID: 62215 Summary: Updating .mod files on Win32 fails Product: gcc Version: 4.9.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: jeffrey.armstrong at approximatrix dot com Created attachment 33373 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33373&action=edit Patch to delete existing .mod file prior to updating Under Win32 using GNU Fortran 4.9.0 or 4.9.1, module files (.mod) are not updated properly when necessary because the code to do so is simply calling "rename()" to move the temporary .mod file to the permanent name without first deleting any existing .mod files. The Windows C runtime states that this operation will fail if a file of the same target name exists already (see the "Remarks" section at http://msdn.microsoft.com/en-us/library/zw5t957f.aspx). Versions 4.8 and earlier of GNU Fortran first performed an "unlink()" on the existing file to delete it, so this bug is new with the 4.9 series. I've attached a patch for 4.9.1 that reinstates the unlink operation that was present in 4.8 and earlier.