davidb
Joined: 17 Jul 2009 Posts: 560 Location: UK
|
Posted: Sat Jan 29, 2022 2:41 pm Post subject: Incorrect detection of Missing Optional argument |
|
|
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.
Code: |
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
|
_________________ Programmer in: Fortran 77/95/2003/2008, C, C++ (& OpenMP), java, Python, Perl |
|