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

How to generate interface source without compiling?

hs-napa
Beginner
916 Views
Hi,

I need to generate interfaces for some old F77 code for better compile time checking. I did not find a way to use the /gen-interfaces:source option without generating the .mod and .obj files.

I suppose there is a simple solution that I just could not find from the compiler documentation and experimenting with the options.

Thanks in advance.

-Heikki
0 Kudos
5 Replies
Les_Neilson
Valued Contributor II
916 Views
Ifpossible you could put the F77 code in a module which the calling routine(s) would USE.
Interface checking would then be provided automatically.

Les

0 Kudos
hs-napa
Beginner
916 Views
Yes, it is possible, but inpractical in this case. There is more than million lines of fortran code in more than 12000 files (basically one subroutine/function per file). It's a lot easier to automate the generating of interfaces than moving all that code into modules.
0 Kudos
Les_Neilson
Valued Contributor II
916 Views
Ah, I understand.
Unless there is a 3rd-partypiece of software that will do it youwill need to write a script to do the job.

I did something along those lines a few years ago, using perl - basically it did the following :
read each fortran source file
parse the subroutine/function statement getting a list of arguments and their type
construct an interface block for this routine
write it to a .ins file

then go through each source file again
make alist of subroutines/functions used by this code
insert an "include" statement for the.ins interface block file written earlier foreach called routine

It was a laborious process and not without problems but I got most of the interface mismatches this way in the end.

You may be better off using modules - we certainly are :-)

Les
0 Kudos
Steven_L_Intel1
Employee
916 Views
Why not just compile normally (with /warn:interface) and then throw away the .obj and .mod files? I don't know of an option to just generate the .f90 files.
0 Kudos
hs-napa
Beginner
916 Views
The problem is that I must keep two workspaces up-to-date if I use /warn:interfaces. One for regular work, and one for manual "check" builds. The reason is that /warn:interfaces and /gen-interfaces options cause the compiler to crash with "internal compiler error" with our codebase. We have also noticed that the compiler omits incorrect code with /gen-interfaces option. We have submitted bug reports on these findings (when we could make a small reproducible example - Intel support would probably frown upon a bug report with example of million lines of code...) We are using compiler version 11.1.054

Some of these bugs have been corrected in the latest release. However, this release has other problems and we cannot take it into use.

For these reasons we cannot take /warn:interfaces into use in our production environment. We have occasionally used /warn:interfaces option to get a list of "interface mismatch" errors to fix. When maintaining code that is not in modules, these types of errors are inevitable. Running these kinds of "check" builds is cumbersome and the compiler omitted code must be thrown away (or made sure nobody is using it by compiling in a "sandbox" workspace).

We would like to automate this process of checking interfaces into our regular builds. This is why I would like to generate interface code without compiling (as the compiling messes things up).

Anyway, thanks for the answer. Now I know that I need to look for another solution. Meanwhile we'll keep reporting bugs with /warn:interfaces and /gen-interfaces and hope that that they will get fixed in future releases.

Best Regards,
-Heikki



0 Kudos
Reply