forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Harmless semicolon shifts warning message to wrong line

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
mecej4



Joined: 31 Oct 2006
Posts: 1368

PostPosted: Sun Feb 16, 2020 11:46 am    Post subject: Harmless semicolon shifts warning message to wrong line Reply with quote

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:
Code:
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:
Code:
[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:
Code:
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!
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6466
Location: Salford, UK

PostPosted: Mon Feb 17, 2020 8:18 am    Post subject: Reply with quote

mecej4

Thanks for the bug report which I have logged.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 6466
Location: Salford, UK

PostPosted: Thu Feb 27, 2020 3:30 pm    Post subject: Reply with quote

This has now been fixed for the next release of FTN95.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group