Silverfrost Forums

Welcome to our forums

Harmless semicolon shifts warning message to wrong line

16 Feb 2020 10:46 #24983

The subroutine below gets compiled without any messages when the default options are used, with Version 8.51 (32 or 64 bit).

If /check or /checkmate is used, however, I see the perplexing warning:

S:\lang\ftn95\V86>ftn95 /check /64 chol.f90
[FTN95/x64 Ver. 8.51.0 Copyright (c) Silverfrost Ltd 1993-2019]
0021)          lnpd = .true.                        ! warning for this line!
WARNING - A 32 bit INTEGER has been converted to REAL with a 24 bit mantissa
    NO ERRORS, 1 WARNING  [<CHOLESKY_FACTOR> FTN95 v8.51.0]

If the unnecessary but harmless semicolon at the end of the subroutine is removed, the warning changes to:

[FTN95/x64 Ver. 8.51.0 Copyright (c) Silverfrost Ltd 1993-2019]
0022)          temp = (trace/real(n))*1.0d-8        ! should have used dble(n)
WARNING - A 32 bit INTEGER has been converted to REAL with a 24 bit mantissa
    NO ERRORS, 1 WARNING  [<CHOLESKY_FACTOR> FTN95 v8.51.0]

The source code of the subroutine:

subroutine cholesky_factor (a,r)
   implicit none
   real*8, dimension(:,:) :: a, r
   integer :: n, i, j, k
   real*8 :: temp, diag, trace
   logical :: lnpd
!
   trace = 0.0d0
   r = 0.0d0
   n = ubound(a,1)
   do i = 1,n
      trace = trace + abs(a(i,i))
      if (a(i,i) <= 0.0d0) then
         lnpd = .true.
         exit
      endif
   end do
   do k = 1,n
      temp =  a(k,k) - dot_product(r(k,1:k-1),r(k,1:k-1))
      if (temp <= 1.0d-12*(1.0d0+abs(a(k,k)))) then
         lnpd = .true.                        ! warning for this line!
         temp = (trace/real(n))*1.0d-8        ! should have used dble(n)
         return
      end if
      diag =  sqrt(temp)
      r(k,k) =  diag
      do j = k+1,n
         r(j,k) =  (a(j,k) - dot_product(r(j,1:k-1),r(k,1:k-1)))/diag
      end do
   end do
   print *, lnpd
end subroutine;         ! the semicolon here is the cause!
17 Feb 2020 7:18 #24984

mecej4

Thanks for the bug report which I have logged.

27 Feb 2020 2:30 #25020

This has now been fixed for the next release of FTN95.

Please login to reply.