soccer jersey forums.silverfrost.com :: View topic - Error messages do not quite point to the error
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 

Error messages do not quite point to the error

 
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: 1897

PostPosted: Sat Mar 25, 2023 2:19 am    Post subject: Error messages do not quite point to the error Reply with quote

In the following source code, I had left out the END SUBROUTINE statement for the CONTAINed subroutine just before the last line.

Code:
! Utility for taking routines declared as untyped externals in
!    SLATEC sources, and checking if they are implicitly typed
!    external functions or are actually subroutines
program scanfuncs
implicit none
integer, parameter :: NFUN = 500
character(10) fnames(NFUN)
character(150) line,linetrim
character(10) rname
integer i,ll,iw,lu,ib,ie,nf
logical found
!
open(11,file='funcs.txt',status='old')
do i=1, NFUN
   read(11,'(A)',end=10) fnames(i)
end do
10 close(11)
open(11,file='exts.txt',status='old')
rewind(11)
nf = i-1
print *,nf,' functions recognized'
do
   read (11,'(A)',end = 100) line
   ll = len_trim(line)
   iw = index(line,'external')
   if(iw == 0)iw = index(line,'EXTERNAL') ! will miss if mixed case in input!
   if (iw /= 0) then
      linetrim = line(iw+9:ll) // ','
      lu = len_trim(linetrim)
      ib = 1
      do
         ie = index(linetrim(ib:lu),',')
         if(ie==0)then
            print *,line
            print *,linetrim
            stop 'Error, no comma found at end'
         endif
         ie = ie+ib-1
         rname = linetrim(ib:ie-1)
         call search(rname,fnames,nf,found) !print *,rname
         if(found)then
            print *,' Input Line:'
            print '(8x,A,/)',line
         endif
         ib=ie+2
         if(ib > lu)exit
      end do
   else
      print *,'"external" not found in line: '
      print *,line
   endif
end do
100 close(11)
stop

contains
   !Could use binary search, but linear search is fast enough
   subroutine search(rname,fnames,nf,found)
   integer, intent(in) :: nf
   character(10), intent(in) :: fnames(nf)
   character(10), intent(in) :: rname
   logical, intent(out) :: found
   integer i
   found = .false.
   do i=1,nf
      if(rname .eq. fnames(i))then
         print 10,trim(rname)
         found = .true.
      endif
   end do
   return
10 format('Routine ',A,' is a known function')
!   end subroutine  ! commented out to display compiler behaviour
end program

The compiler output error messages that had me confused for a few moments.
Code:
ERROR S:\ALGO\slatec\IBED\src\hide\scanfnc.F90 15:  FNAMES appears on the left hand side of an assignment yet has the INTENT(IN) attribute
ERROR S:\ALGO\slatec\IBED\src\hide\scanfnc.F90 20:  NF appears on the left hand side of an assignment yet has the INTENT(IN) attribute
ERROR S:\ALGO\slatec\IBED\src\hide\scanfnc.F90 39:  RNAME appears on the left hand side of an assignment yet has the INTENT(IN) attribute
ERROR S:\ALGO\slatec\IBED\src\hide\scanfnc.F90 40:  Compilation abandoned
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Mar 25, 2023 7:37 am    Post subject: Reply with quote

Thank you for the feedback. I have made a note of this fault.
Back to top
View user's profile Send private message AIM Address
PaulLaidler
Site Admin


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

PostPosted: Sat Nov 11, 2023 5:17 pm    Post subject: Reply with quote

This has now been cleaned up for a future release of FTN95.
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1897

PostPosted: Sun Nov 12, 2023 2:51 am    Post subject: Reply with quote

Thanks.
Back to top
View user's profile Send private message
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