Silverfrost Forums

Welcome to our forums

Error in assigning value to an array section

12 Jul 2022 3:38 #29164

The following test program shows an assignment being made to an array section using a subscript triplet.

program arraybug
implicit none
logical prms(13)
integer kpm,PrimeNum,Rescnt,maxprms
integer i,j,k
!
prms = .true.
kpm = 12; maxprms=13; Rescnt=8; PrimeNum = 7
i =13; j = maxprms

prms( i:j:PrimeNum*Rescnt) = .false.
print '(13L3)',prms ! prms(13) incorrectly displayed as .T.

k = PrimeNum*Rescnt
prms(i:j:k) = .false.
print '(13L3)',prms ! prms(13) now displayed as .F.

end program

When the third part of the triplet is present as a variable, there is no problem. However, when an expression is used instead for this third part, an error occurs, as the following output (any version of FTN95, with or without /64) shows:

 T  T  T  T  T  T  T  T  T  T  T  T  T                                                                                   
 T  T  T  T  T  T  T  T  T  T  T  T  F
 
12 Jul 2022 6:17 #29165

mecej4

Thank you for the bug report. I have made a note that this needs fixing.

13 Jul 2022 1:51 #29169

This bug has now been fixed for the next release of FNT95.

Please login to reply.