I have two versions of Intel compilers on our HPC: the version 14.0.3 and the version 17.0.0 .
The intrisic procedure minloc returns different values when the Fortran program is compiled with these 2 versions. It happens when using a mask and that this mask is false. With the version 14.0.3, it returns 0, while with the version 17.0.0., it returns 1.
Here is the Fortran code:
program minloctest implicit none integer::i,j,n,m(1) integer,allocatable::array(:) n=10 allocate(array(10)) array=(/(i,i=1,n)/) j=3 m=0 m=minloc(array,array.eq.j) print*,m j=11 m=0 m=minloc(array,array.eq.j) print*,m end program
I compiled it using:
ifort minloctest.f90 -o minloctest
Using the version 14.0.3, I got:
Using the version 17.0.0, I got:
I do not understand why the answers are different. Could it be a bug? Could you help me, please?
In advance thank you.
I'm actually a bit puzzled by the 14.0 result, but that was long ago enough that I don't remember all the history here. You want -standard-semantics or -assume noold_maxminloc. This controls the behavior when all elements of the mask are false. The default is old_maxminloc which returns 1 in this case. This is described in our documentation of MINLOC.