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 

FTN95: Error with FORALL

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



Joined: 18 Aug 2005
Posts: 15

PostPosted: Sun Sep 11, 2005 8:03 am    Post subject: FTN95: Error with FORALL Reply with quote

The following program produces incorrect output:

Code:

! [JvO] 2005-09-11 SalfordSM-Err.f95

PROGRAM comss
IMPLICIT NONE

integer :: j
INTEGER, PARAMETER :: p = 8 ! Number of variables
real, dimension(p,p) :: h
CHARACTER(10) :: dd, tt
CHARACTER(LEN=*), PARAMETER :: fmt1="(A/(8f8.2))", fmt2="(/T3,A,TR4,A)"

call date_and_time(dd, tt)
dd(5: ) = "-" // dd(5:6) // "-" // dd(7:Cool
tt(3: ) = ":" // tt(3:4) // ":" // tt(5:6)
WRITE (*, fmt2) dd, tt

h = 2.25 + reshape((/ (real(j)-0.4, j=1,p**2) /), (/p,p/) )

print fmt1, " CM [020] H:", H(:,1), (h(j,j),j=1,p)
FORALL (j = 1:p)
h(j, j) = h(j, j) + 1.125 ! Salford: ERROR
end forall
print fmt1, " CM [024] H:", H(:, 1), (h(j,j),j=1,p)

END PROGRAM comss

! D:FortranTestSalford>ftn95 /check sm-err /lgo
! [FTN95/Win32 Ver. 4.8.0 Copyright (C) Salford Software Ltd 1993-2005]
! NO ERRORS [<COMSS> FTN95/Win32 v4.8.0]
! Creating executable: D:FortranTestSalfordlgotemp@.exe
! Program entered

! 2005-09-11 15:34:35
! CM [020] H:
! 2.85 3.85 4.85 5.85 6.85 7.85 8.85 9.85
! 2.85 11.85 20.85 29.85 38.85 47.85 56.85 65.85
! CM [024] H:
! 66.97 3.85 4.85 5.85 6.85 7.85 8.85 9.85
! 66.97 66.97 66.97 66.97 66.97 66.97 66.97 66.97
! =======
! Expected output::
! CM [020] H:
! 2.85 3.85 4.85 5.85 6.85 7.85 8.85 9.85
! 2.85 11.85 20.85 29.85 38.85 47.85 56.85 65.85
! CM [024] H:
! 3.98 3.85 4.85 5.85 6.85 7.85 8.85 9.85
! 3.98 12.98 21.98 30.98 39.98 48.98 57.98 66.98



[JvO]
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Sep 12, 2005 12:28 am    Post subject: FTN95: Error with FORALL Reply with quote

Thanks for the information.
Back to top
View user's profile Send private message AIM Address
JvO



Joined: 18 Aug 2005
Posts: 15

PostPosted: Mon Sep 12, 2005 8:26 am    Post subject: FTN95: Error with FORALL Reply with quote


Another program showing incorrect FORALL (or maybe COUNT ?)
I signalled this already in 2004, but not yet repaired.

Code:

! [JvO] 2004-04-28 Count-err.f95
program count_E
implicit NONE
integer :: i, j = 4, t(5, 5) = -1
logical :: m(5, 5) = .true., x(5,5) = .false.

m(2:3 , : ) = .false. ; m(4, 5) = .false.
print "(5L4)", m ; print *
do i = 2, 4
do j = 2, 4
t(i,j) = count(m(i-1:i+1, j-1:j+1))
end do
end do
print "(5I4)", t ; print *
forall (i=2:4, j=2:4, t(i,j) == 3 .or. t(i,j) == 4 .and. x(i,j) )
x(i,j) = .true.
end forall
print "(5L4)", x ; print *
forall (i=2:4, j=2:4 )
t(i,j) = count(m(i-1:i+1, j-1:j+1))
end forall
print "(5I4)", t ; print *
end program count_E

! Salford [2005]: Program entered
! T F F T T
! T F F T T
! T F F T T
! T F F T T
! T F F F T
!
! -1 -1 -1 -1 -1
! -1 3 3 6 -1
! -1 3 3 6 -1
! -1 3 2 5 -1
! -1 -1 -1 -1 -1
!
! F F F F F
! F T T F F
! F T T F F
! F T F F F
! F F F F F
!
! -1 -1 -1 -1 -1
! -1 5 5 5 -1
! -1 5 5 5 -1
! -1 5 5 5 -1
! -1 -1 -1 -1 -1



[JvO]
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


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

PostPosted: Mon Sep 12, 2005 8:49 am    Post subject: FTN95: Error with FORALL Reply with quote

Thank you for this.

This happens to be the same bug as your first example in this correspondance.
It is a regression at version 4.8 which has now been fixed.
The problem could affect may programs that use FORALL.
If you encounter further problems with FORALL please go back to version 4.7 and recheck after the release of version 4.9 (coming soon).

There is an outstanding problem with FORALL (logged under your name) relating to a sample program given in the Fortran Standard. In fact this is the only reported bug that is currently outstanding.

With kind regards


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