Fortran module file format
The Fortran standard does not define a .mod
file format, and every compiler has a unique incompatible format. This means that .mod
files are not portable between different compilers or even different versions of the same compiler.
Gfortran .mod files are GZIP text. The format is not documented, and it is not recommended to rely on the format. The .mod
file format is not guaranteed to be stable between different versions of Gfortran.
Extract the .mod file header like:
gunzip -c file.mod | head
The outputs starts like:
GFORTRAN module version ‘15’ created from …
GCC version module file version
-----------------------------------
up to 4.3.2 unversioned
4.4 0
4.5.1 4
4.6.3 6
4.7.0pre 8
4.7.1 9
4.8.[1-3] 10
4.9.2 12
5.1.0 14
8.1.0 15
9 - 13 15
If you get gzip: not in gzip format
then the .mod file is probably from another compiler vendor e.g. Intel oneAPI.