Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
23 Views

Intrinsic procedure minloc returns different values with different versions of ifort : possible mistake?

Dear,

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:

3

0

Using the version 17.0.0, I got:

3

1

I do not understand why the answers are different. Could it be a bug? Could you help me, please?

In advance thank you.

Yours sincerely,

Jeremie

0 Kudos
2 Replies
Highlighted
23 Views

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.

0 Kudos
Highlighted
Beginner
23 Views

Thank you for the explanation.

Jeremie

0 Kudos