Arrays as dummy arguments and memory management with ifort.

Arrays as dummy arguments and memory management with ifort.

By doing a coding error, I have discovered something, what I believe to be a rather interesting feature of the Intel Fortran compiler. I had a main program declaring an array with the following dimensions:

REAL :: ARRAY(S,A,B)

This array was passed to a subroutine, however the intent(in) argument of the subroutine was with wrong dimension

REAL,INTENT(IN) :: ARRAY(S,A*B+C)

Here the constant dimensions are defined as follows::

Integer,parameter :: S=1000, A=88, B=6, C=3

All the compilers except ifort showed error, stating that the arrays have non conforming sizes.

It is a simple error and I fixed it immediately, however the results from ifort caught my attention.

ifort requires the option -gen-interfaces to engage automatic checking, in the absence of explicit interface in source code. The only situation where it's on by default is in Visual Studio projects, so in linux you must ask for it.
The only chance of some kind of automatic fix-up would be with inter-procedural analysis (in-lining) but that is as likely to make it worse.