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

A puzzle about maxloc

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
Highlighted
Black Belt
17 Views

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

0 Kudos
Highlighted
Black Belt Retired Employee
17 Views

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

0 Kudos