This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, Fortran] [4.4 Regression] .mod file versioning causes error instead of overwritting the file
- From: Tobias Burnus <burnus at net-b dot de>
- To: gcc-patches at gcc dot gnu dot org, fortran at gcc dot gnu dot org
- Date: Fri, 27 Feb 2009 00:46:54 +0100
- Subject: [Patch, Fortran] [4.4 Regression] .mod file versioning causes error instead of overwritting the file
>From the bug report:
| In order to not trigger a compilation cascade, gfortran only overwrites a .mod
| file when its MD5 sum has changed.
|
| Seemingly, the mod-file versioning has the side effect that the MOD file is not
| overwritten if there are no other changes but the version number, which causes
| the version-mismatch error.
The simple solution is to include the version number in the has-changed check.
Build and tested on x86-64, regtesting still running.
OK when it passes?
Tobias
2009-02-27 Tobias Burnus <burnus@net-b.de>
PR fortran/39309
* module.c (read_md5_from_module_file): Include mod version
in had-changed test.
Index: gcc/fortran/module.c
===================================================================
--- gcc/fortran/module.c (Revision 144456)
+++ gcc/fortran/module.c (Arbeitskopie)
@@ -4739,8 +4739,19 @@ read_md5_from_module_file (const char *
return -1;
/* Read two lines. */
- if (fgets (buf, sizeof (buf) - 1, file) == NULL
- || fgets (buf, sizeof (buf) - 1, file) == NULL)
+ if (fgets (buf, sizeof (buf) - 1, file) == NULL)
+ {
+ fclose (file);
+ return -1;
+ }
+
+ /* The file also needs to be overwritten if the version number changed. */
+ n = strlen ("GFORTRAN module version " MOD_VERSION " created");
+ if (strncmp (buf, "GFORTRAN module version " MOD_VERSION " created", n) != 0
+ || strlen (buf) < (unsigned) n)
+ return -1;
+
+ if (fgets (buf, sizeof (buf) - 1, file) == NULL)
{
fclose (file);
return -1;