I'm using ifort (intel 18) to compile this module:
module test integer:: a contains subroutine f() end subroutine end module test
To be used with this program compiled with ifort (intel 17):
program ping use test write ( *, '(a)' ) ' Hello, world!' end
But I am getting this error:
test.f90(2): error #7012: The module file cannot be read. Its format requires a more recent F90 compiler. [TEST]
However, I can compile the module with ifort (intel17) and then 'use' it in a program compiled with ifort (intel18) without any issues.
So, it it looks like the fortran modules are forwards compatible, but not backwards compatible between ifort compiler versions. Is there anything that I can do to get the module to work in the backwards compatible case?
What you are asking for is that the older compiler to be able to read *.mod files that are in a format that had not been defined when the compiler was built. Usually, this is unlikely to be possible, just as you cannot run a Windows EXE on an old MSDOS machine.
Occasionally, changes to the module file format can be so radical as to make old module files unusable by a new version of the compiler, and new module files have to be generated by recompiling from source.
When you open the mod file with an editor that can read Hex code, then you will actually see the version number of the compiler which has generated that mod file. So there is an explicit check for the format. As mecej4 already noted, .mod files of different versions of the same compiler are more often incompatible than compatible.