Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

A puzzle about maxloc

gao_l_
Beginner
89 Views

Dear , sir , may I ask you , Why Maxloc return 1 when all mask was .false. ? 

As follow:

D:\ourdoc\Desktop\my\simp_fcode>ifort simp.f90 -o x.exe
Intel(R) Visual Fortran Compiler XE for applications running on IA-32, Version 15.0.0.108 Build 20140726
Copyright (C) 1985-2014 Intel Corporation.  All rights reserved.

Microsoft (R) Incremental Linker Version 12.00.21005.1
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:x.exe
-subsystem:console
simp.obj

D:\ourdoc\Desktop\my\simp_fcode>x.exe
  why 1 ??           1
 it's ok           0

D:\ourdoc\Desktop\my\simp_fcode>type simp.f90
program test_maxloc
  integer to
  integer :: x(3) = [1,2,3]
  write(*,*) " why 1 ??" , MaxLoc( x , 1 ,  x > 4 )
  write(*,*) "it's ok" , MaxLoc( x ,  x > 4 )
end program test_maxloc

0 Kudos
2 Replies
mecej4
Black Belt
89 Views

This error is not present in the 16.0.4 and 17.0.4 compilers.

Steve_Lionel
Black Belt Retired Employee
89 Views

See the description of option /assume:[no]old_maxinloc. I think the default changed in more recent versions.

Reply