Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28446 Discussions

Backwards compatibility between intel 18 and intel 17 ifort compilers

Sarkauskas__Nick
Beginner
850 Views

Hi,

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]
      use 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?

Thanks,
Nick

0 Kudos
3 Replies
mecej4
Honored Contributor III
850 Views

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.

0 Kudos
Juergen_R_R
Valued Contributor I
850 Views

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. 

0 Kudos
Lorri_M_Intel
Employee
850 Views

You can go the other way however.  You can build a .mod file with the 17.0 compiler and it can be used by 18.0 or later.

              --Lorri

0 Kudos
Reply