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 

Bug in program using SPREAD

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

PostPosted: Sun Feb 26, 2017 7:23 pm    Post subject: Bug in program using SPREAD Reply with quote

As far as I can see, there is nothing wrong in this test program, which uses the SPREAD intrinsic.
Code:
program ftnbug
implicit none
integer, parameter :: l = 1, m = 20, n = 3
logical            :: l3v(m)
double precision   :: r(m),g(m,l),dg(m,n),d5v(m,n),v(m)
integer i

l3v(1)    = .TRUE.
l3v(2:20) = .FALSE.
r(1:)     = 1d-3;   r(2)    = 63d0 ;    g       = 1d-4
dg(:,1)   = 1d0;    dg(:,2) = 2d-3;     dg(:,3) = 1d-7
v = 2d-4;           d5v     = 0d0

where (spread(l3v,dim = 2, ncopies = n))
   d5v = dg(:m,:)*(                               &
            spread(v(:m),dim=2,ncopies=n)         &
           -spread(r(:m),  dim = 2, ncopies = n)  &
           *spread(g(:m,1),dim = 2, ncopies = n)  &
           )
end where

write(*,'(3ES12.3)')(d5v(i,:),i=1,m)

end program

FTN95 8.05 with /checkmate gives a runtime error: access violation at line 14, attempt to read from location F0F0F0F4; the instruction is mov eax, [ecx+04], with ECX = F0F0F0F0.

FTN95 8.05 with /64 gives a compile time error:
Quote:
*** The test of the enclosing WHERE statement is rank 2, whereas the left hand side of this assignment is a scalar.

The variable d5v is declared as a 2-D array, so something must have confused the compiler.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Feb 27, 2017 8:47 am    Post subject: Reply with quote

Thank you for the feedback. I have logged this as needing investigation.
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