Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

A puzzle about maxloc

gao_l_
초급자
485 조회수

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 포인트
2 응답
mecej4
명예로운 기여자 III
485 조회수

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

0 포인트
Steve_Lionel
명예로운 기여자 III
485 조회수

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

0 포인트
응답