aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/fortran/module.c')
-rw-r--r--gcc/fortran/module.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c
index bfc4ef9..c234879 100644
--- a/gcc/fortran/module.c
+++ b/gcc/fortran/module.c
@@ -4739,8 +4739,18 @@ read_md5_from_module_file (const char * filename, unsigned char md5[16])
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)
+ return -1;
+
+ if (fgets (buf, sizeof (buf) - 1, file) == NULL)
{
fclose (file);
return -1;