Arrays as dummy arguments and memory management with ifort.

Arrays as dummy arguments and memory management with ifort.

Dear Forum Members,

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.  

The array size of dummy argument is greater than the usable size of the actual array (actual argument ARRAY: 21120000 bytes, dummy argument ARRAY: 21240000 bytes).

With ifort I was able to compile run and produce perfect results, all other compilers showed segmentation fault. And the error printed above. In the intent(in) array has more memory,

not less. The situation is not so bad.

My question is : Does ifort has such feature to fix the sizes of the dummy arrays. Perhaps I am mistaking, but at least I find it very interesting observation.

Thanks,

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.

Login to leave a comment.