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 

Array asignment problem

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
JohnCampbell



Joined: 16 Feb 2006
Posts: 1723
Location: Sydney

PostPosted: Sat Jan 21, 2017 12:59 am    Post subject: Array asignment problem Reply with quote

The following example of array assignment fails with FTN95 Ver 8.05 for both 32 and /64.
The array a is not correctly assigned, as LHS = calculation of RHS array.
I am assuming this is valid Fortran 90/95 syntax ?
32 and 64 give different wrong results.
Code:
! Test of array assignment
! expected result
! a = 1 1 2 3 4
! b = 1 1 2 4 8
!
!  fails with ftn95 /lgo
!  fails with ftn95 /64 /lgo
!
  implicit none
  integer :: i, a(5) = 1, b(5) = 1
!
! array assignment 
  a(2:5) = (/ (sum(a(1:i-1)),i = 2,5) /)
  write (*,*) ' a=',a
!
! DO loop asignment 
  do i = 2,5
     b(i) = sum(b(1:i-1))
  end do
  print '(A,5I2)',' a =',a,' b =',b
  end program
Back to top
View user's profile Send private message
mecej4



Joined: 31 Oct 2006
Posts: 652

PostPosted: Sat Jan 21, 2017 3:02 am    Post subject: Reply with quote

With the 32-bit compiler, the option /check causes integer overflow to be detected during the array expression evaluation and assignment.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Sat Jan 21, 2017 1:41 pm    Post subject: Reply with quote

I have logged this for investigation.
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