12 Jan 2025 5:20
#31811
Paul,
I think you need to look at this one.
!
! With either the 32 bit or 64 bit complier, with /checkmate the following
! error stops compilation at the line indicated:
!
! error 967 - In the INTERFACE to F1, the first argument (A) is rank 1,
! but it is a scalar in this call
!
! F2 does not generate this error.
!
! If a is not allocatable, and simply real*8 :: a(10) /checkmate does not
! report error 967.
!
! If the contains section of program P1 is commented out and instead uses
! pmod the program compiles and runs without error with /checkmate.
!
module pmod
implicit none
contains
logical function f1( a )
real*8, intent(in) :: a(:)
f1 = .false.
if (size(a) .gt. 1) f1 = .true.
end function f1
function f2( a ) result ( returnvalue )
real*8, intent(in) :: a(:)
logical :: returnvalue
returnvalue = .false.
if (size(a) .gt. 1) returnvalue = .true.
end function f2
end module pmod
program p1
!use pmod
implicit none
real*8, allocatable :: a(:)
!real*8 :: a(10)
integer :: i
allocate(a(10))
do i = 1, 10
a(i) = i
end do
print*, f1(a) ! #####
print*, f2(a)
contains
logical function f1( a )
real*8, intent(in) :: a(:)
f1 = .false.
if (size(a) .gt. 1) f1 = .true.
end function f1
function f2( a ) result ( returnvalue )
real*8, intent(in) :: a(:)
logical :: returnvalue
returnvalue = .false.
if (size(a) .gt. 1) returnvalue = .true.
end function f2
end program p1