29 Jan 2022 1:41
#28725
When compiled with /checkmate turned on (version 8.80), the following code gives a run-time error. 'Reference through missing OPTIONAL argument'.
(It worked fine with 8.70)
However, the code is correct and works OK with NAG and gfortran compilers.
module mmm
contains
subroutine xxx(m, a, b)
integer m
double precision, optional :: a(:), b(:)
print *, m, a
end subroutine
subroutine yyy(m, a, b)
integer m
double precision, optional :: a(:), b(:)
! This call is valid even if a and/or b not provided
call xxx(m, a, b)
end subroutine
subroutine caller(func)
interface
subroutine func(m, a, b)
integer m
double precision, optional :: a(:), b(:)
end subroutine
end interface
call func(1, (/1.0d0, 1.0d0/))
end subroutine
end module
program anon
use mmm
call caller(yyy)
end