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 

Unexpected subscript out of bounds error
Goto page Previous  1, 2
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


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

PostPosted: Wed Sep 01, 2021 12:35 pm    Post subject: Reply with quote

In the next release of FTN95 the following code will run successfully...

Code:
!FTN95$OPTIONS(CHECK)
program subbug
integer, parameter :: ndim=20, nrp1=11
integer iwksp(100)
iwksp = 0
call vaddp(ndim, iwksp(ndim+nrp1))
end program

!FTN95$OPTIONS(INHIBIT_CHECK 20)
subroutine vaddp(ndimi, ja)
integer ndimi, ja(ndimi,*)
i = ja(1,4)
print *, i
end subroutine


Also the following (with a minus) will switch check 20 back on...

Code:
!FTN95$OPTIONS(-INHIBIT_CHECK 20)
Back to top
View user's profile Send private message AIM Address
mecej4



Joined: 31 Oct 2006
Posts: 1885

PostPosted: Sun Sep 26, 2021 3:45 pm    Post subject: Reply with quote

Thanks, Paul, and I look forward to using the revised subscript checking features when the next version of the compiler is released.

Just today, I ran across a detailed discussion of multidimensional array arguments on the fortran-lang.org group ( https://fortran-lang.discourse.group/t/fortran-best-practice-minibook/1790/50 ). One of the members, a NAG Fortran compiler group member, posted the following quote from the Fortran 2003 Standard, Section 12.4.1.5, last paragraph (or the 2018 Standard, Section 15.5.2.11, paragraph 5):

5 An actual argument that represents an element sequence and corresponds to a dummy argument that is an array is sequence associated with the dummy argument. The rank and shape of the actual argument need not agree with the rank and shape of the dummy argument, but the number of elements in the dummy argument shall not exceed the number of elements in the element sequence of the actual argument. If the dummy argument is assumed-size, the number of elements in the dummy argument is exactly the number of elements in the element sequence.

The last sentence in the quotation applies to the case being considered in this thread.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sun Sep 26, 2021 6:49 pm    Post subject: Reply with quote

mecej4

Thanks for the feedback and quote. I accept that the code is Standard conforming. At the moment the runtime checking mechanism does not correctly check the bounds in this particular context.
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
Goto page Previous  1, 2
Page 2 of 2

 
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