program main
implicit none
integer :: i, j, idx(2)
do concurrent (j=1:5, i=1:5)
idx = [i, j]
! idx(1) = i; idx(2) = j ! This works.
end do
end program main
Compile and run the program with ifort
ifort -warn all -check all -error-limit 1 -O0 -g -assume byterecl -traceback test.f90 && ./a.out
(same flags with fpm --profile debug --compiler ifort) leaves me an error
You may also want to post this at the Intel Fortran forum and look for feedback from Intel support with -check option and the cases where this option runs into difficulties.
Thanks! While I am playing around I found that with --profile debug --compiler ifort what also doesn’t work is
program main
implicit none
integer :: i, j
do concurrent (j=1:5, i=1:5)
associate (idx => pair(i, j))
write (*, *) idx
end associate
end do
contains
pure function pair(i_, j_) result(ret)
integer, intent(in) :: i_, j_
integer :: ret(2)
ret = [i_, j_]
end function pair
end program main
The compiler throws me two remarks and a bunch of incorrect indices
test.f90(6): remark #7712: This variable has not been used. [I]
do concurrent (j=1:5, i=1:5)
------------------------^
test.f90(6): remark #7712: This variable has not been used. [J]
do concurrent (j=1:5, i=1:5)
-----------------^
-858993460 -858993460
-858993460 -858993460
-858993460 -858993460
...
I guess I will just use --profile release and declare an array integer :: idx(2) and assign it explicitly in the loop for now.
It was the “-check stack” option that triggered it.
fpm run --compiler ifort -profile debug -flag '-check nostack'
"ifort file.f90 -check all " triggers it, and “fpm --profile debug --compiler ifort” uses “-check all”; but if you turn off just “stack” it runs.
So the simplest trigger is just “ifort -check stack file.f90”.
That sums it up nicely. It really is a useful switch which I agree fpm should use in debug mode; but one cannot help but smile in this case when the debug flag adds the bug and then detects it.