So I left my code unattended for about 2 years. One of the big selling points of Fortran, at least the way I see it, is that the codes should not “age” as fast as some younger ecosystems, such as Python. Meanwhile, jumping from gfortran 12 to 13, my code would not compile anymore, with an associate
statement that I would consider correct:
././src/findstar.f90:96:49:
96 | associate (ilo => max(xymax(1) - rslice, 1), &
| 1
Error: Symbol ‘ilo’ at (1) has no IMPLICIT type
<ERROR> Compilation failed for object " src_findstar.f90.o "
<ERROR> stopping due to failed compilation
Moving over to ifort
or ifx
, both segfault at the second line of this little block:
associate (calibarea => frame_flat % data(33:n1-32, 33:n2-32))
frame_flat % data(:,:) = frame_flat % data / average_safe(calibarea)
end associate
where frame_flat%data
is an associated (yes, tested that) real
pointer and average_safe
is a boring function that basically averages over non-nan values:
pure function average_safe_2d(x) result(m)
use iso_fortran_env, only: int64
real(fp), intent(in) :: x(:,:)
real(fp) :: m
integer :: i, j
integer(int64) :: n
m = 0; n = 0
do j = 1, size(x, 2)
do i = 1, size(x, 1)
if (ieee_is_normal(x(i,j))) then
m = m + x(i,j)
n = n + 1
end if
end do
end do
m = m / n
end function
Making the code to compile with either of them would require changing many, many places in the code for no good reason… so I resigned to just compiling and running my code in a Docker container with gfortran 12, which last seemed to worked. What to do…
Have a sunny day!
Dominik