|
forums.silverfrost.com Welcome to the Silverfrost forums
|
View previous topic :: View next topic |
Author |
Message |
JvO
Joined: 18 Aug 2005 Posts: 15
|
Posted: Sun Sep 11, 2005 8:03 am Post subject: FTN95: Error with FORALL |
|
|
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:
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Mon Sep 12, 2005 12:28 am Post subject: FTN95: Error with FORALL |
|
|
Thanks for the information. |
|
Back to top |
|
|
JvO
Joined: 18 Aug 2005 Posts: 15
|
Posted: Mon Sep 12, 2005 8:26 am Post subject: FTN95: Error with FORALL |
|
|
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 |
|
|
PaulLaidler Site Admin
Joined: 21 Feb 2005 Posts: 7927 Location: Salford, UK
|
Posted: Mon Sep 12, 2005 8:49 am Post subject: FTN95: Error with FORALL |
|
|
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 |
|
|
|
|
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
|