Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
27234 Discussions

Incorrect output on minloc and maxloc of empty array

vzecca
Beginner
397 Views

!Incorrect output: must be compiled and run
program intrinsic_mmloc_4
integer, allocatable, dimension(:) :: d
integer, allocatable, dimension(:,:) :: a
integer, dimension(2) :: b

allocate (d(0))
if (maxloc (d, 1) .ne. 0) print *,'maxloc fails'
allocate (a(1, 0))
b = minloc (a)
if (any (b .ne. 0)) print *,'minloc fails'
end program

Labels (1)
0 Kudos
1 Solution
andrew_4619
Honored Contributor I
389 Views

There are a number of topic on this area. see this one linked beklow and other linked topics maybe that will help. I didn't study your case specificaly.

https://community.intel.com/t5/Intel-Fortran-Compiler/Change-in-result-of-MINLOC-MAXLOC-functions-wh...

https://community.intel.com/t5/Intel-Fortran-Compiler/Unhelpful-MINLOC-MAXLOC-documentation/m-p/1006...

 

View solution in original post

3 Replies
andrew_4619
Honored Contributor I
390 Views

There are a number of topic on this area. see this one linked beklow and other linked topics maybe that will help. I didn't study your case specificaly.

https://community.intel.com/t5/Intel-Fortran-Compiler/Change-in-result-of-MINLOC-MAXLOC-functions-wh...

https://community.intel.com/t5/Intel-Fortran-Compiler/Unhelpful-MINLOC-MAXLOC-documentation/m-p/1006...

 

vzecca
Beginner
364 Views

Thank you, Andrew, for the suggestion.

The correct execution of the code requires opetion -assume nooldmaxminloc

which adheres to the Fortran standard.

Unfortunately the default option violates the standard.

Closing this issue.

Steve_Lionel
Black Belt Retired Employee
347 Views

You can use the option -standard-semantics to change defaults that don't match the standard. In all cases, these are situations where earlier versions of the standard were silent, and the developers chose an option that conflicted with a later revision. If existing code would break, or performance would suffer significantly, the default was left the same. 

See https://software.intel.com/content/www/us/en/develop/articles/intel-fortran-compiler-support-for-for... for a list of these conflicting defaults.

Reply