The following code results with successful compilation using gfortran 9.2 but fails using intel compiler 19 u5:
program check_findloc
implicit none
logical :: just(5)
real(8), parameter :: small = 1d-5, sep = 1d-3
integer, parameter :: lines = 100, maxseg_in_line = 5000
real(8) :: zline(maxseg_in_line, lines)
integer :: n, line, l, loc
just(1:3) = .false.
just(4:5) = .true.
n = findloc(just, .true., dim=1, back=.true.)
write(*, *) n
line = 1
loc = maxseg_in_line / 10
do n = 1, loc
zline(n, line) = sep * dble(n)
end do
l = findloc(abs(zline(1:loc, line) - sep) > small, .true., dim=1, back=.true.)
write(*, *) l
end program check_findloc
The error returned by intel compiler:
check_findloc.f90(17): catastrophic error: **Internal compiler error: internal abort** Please report this error along with the circumstances in which it occurred in a Software Problem Report. Note: File and line given may not be explicit cause of this error.
Amending the code a little bit - by making the subtraction outside of the findloc function (but usign the abs within it) works, i.e. the following code results with successful compilation using both gfortran 9.2 and ifort 19 u5:
program check_findloc
implicit none
logical :: just(5)
real(8), parameter :: small = 1d-5, sep = 1d-3
integer, parameter :: lines = 100, maxseg_in_line = 5000
real(8) :: zline(maxseg_in_line, lines), temporary(maxseg_in_line)
integer :: n, line, l, loc
just(1:3) = .false.
just(4:5) = .true.
n = findloc(just, .true., dim=1, back=.true.)
write(*, *) n
line = 1
loc = maxseg_in_line / 10
do n = 1, loc
zline(n, line) = sep * dble(n)
end do
temporary(1:loc) = zline(1:loc, line) - sep
l = findloc(abs(temporary(1:loc)) > small, .true., dim=1, back=.true.)
write(*, *) l
end program check_findloc
Also - omitting the back input from the findloc - makes the original source compile successfully.
The OS details:
OS : CentOS 7.5
Compiler : intel parallel studio xe/2019 update 5
gcc : 9.2.0
Thanks for the help.
Ah, this is the program you posted in comp.lang.fortran. It still fails in 19.1. Please report it to Intel using the Online Service Center. Posting here is not guaranteed to make it to the developers.
Thanks.
Sent the request in https://supporttickets.intel.com/?lang=en-US
Thank you for reporting this. I am currently investigating this issue.
https://software.intel.com/en-us/forums/intel-fortran-compiler/topic/844211#comment-1952038
Thanks, would love to hear if it is resolved...
Any news yet? I have the same issue.
For more complete information about compiler optimizations, see our Optimization Notice.