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 

False runtime error for allocatable arrays in WHERE block

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

PostPosted: Sun Oct 14, 2018 2:13 pm    Post subject: False runtime error for allocatable arrays in WHERE block Reply with quote

The following code does some simple operations with allocatable array variables and uses them in a WHERE construct. The program is free of errors and the expected output is " F T T". With FTN95, we do get the correct output with or without /64, with or without /check, as long as /checkmate is not specified. When /checkmate is used, the 32-bit EXE crashes with
Code:
Access Violation
The instruction at address 00401495 attempted to read from location 024251fc in file tmsk.f90 at line 16

 TMASK -  in file tmsk.f90 at line 16 [+0495]

[P.S.: Note that the reported line number of the crash is wrong. It should actually be 18, as can be seen by locating the crashing machine instruction, and as reported with /64 below.]

Similarly, with /checkmate the 64-bit EXE crashes with
Code:
Access violation (c0000005) at address 401c12

Within file tmsk.EXE
in TMASK in line 18, at address 722

The crashes do not occur if the arrays are allocated statically.

Here is the source code for the test program.
Code:
program tmask
   implicit none
   integer, allocatable :: KAu(:)
   logical, allocatable :: LAv(:), LBv(:)
   real, allocatable    :: TAu(:)
   integer :: n, nf, naa, nc
   integer :: iaa(4) = [1, 6, 5, 4]
   integer :: ia(10) = [-2, 2, 2, 2,-2, -2, 1, 6, 5, 4]
   !
   nf = 3; n = 0; nc = 2
   naa = nf - n
   Allocate (KAu(naa), TAu(naa), LAv(naa), LBv(naa))
   LBv = .false.
   KAu = iaa(:naa)
   LAv = KAu > nc
   where (LAv)
      TAu = 1.0
      LBv = ia(KAu) == (-2) .or. ia(KAu) == (-4)
   end where
   where (LBv)
      TAu = -TAu
   end where
   print '(8L4)', LBv
end program


Last edited by mecej4 on Mon Oct 15, 2018 12:56 pm; edited 1 time in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Oct 15, 2018 7:37 am    Post subject: Reply with quote

Thank you for this report. I can confirm that this is still an issue and needs investigating.
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