On OSX 10.3 PPC with gfortran version 4.3.0 20070105, the following code: ! tests FORALL statements with a mask program forall_8 real, dimension (5, 5, 5, 5) :: a, b, c, d
a (:, :, :, :) = 4 forall (i = 1:5) a (i, i, 6 - i, i) = 7 end forall forall (i = 1:5) a (i, 6 - i, i, i) = 7 end forall forall (i = 1:5) a (6 - i, i, i, i) = 7 end forall forall (i = 1:5:2) a (1, 2, 3, i) = 0 end forall b (:, :, :, :) = 4 do i = 1, 5 b(6 - i, i, i, i) = 7 b(i, 6 - i, i, i) = 7 b(i, i, 6 - i, i) = 7 end do b(1, 2, 3, 1) = 0 b(1, 2, 3, 3) = 0 b(1, 2, 3, 5) = 0 if (any (a /= b )) call abort () forall (i = 1:5, j = 1:5, k = 1:5, ((a (i, j, k, i) .gt. 6) .or. (a (i, j, k, j) .gt. 6))) forall (l = 1:5, a (1, 2, 3, l) .lt. 2) b (i, j, k, l) = i - j + k - l + 0.5 end forall end forall forall (i = 1:5, j = 1:5, a (i, j, 1, 1) .lt. 8) ! forall (i = 1:5, j = 1:5) forall (k = 1:5, ((a (i, j, k, i) .gt. 6) .or. (a (i, j, k, j) .gt. 6))) forall (l = 1:5, a (1, 2, 3, l) .lt. 2) a (i, j, k, l) = i - j + k - l + 0.5 end forall end forall end forall print *, a(5, 1, 1, 1), b(5, 1, 1, 1) if (any (a /= b )) call abort () end gives: 7.000000 4.500000 Abort I get the same result on AMD64. If I replace forall (i = 1:5, j = 1:5, a (i, j, 1, 1) .lt. 8) by forall (i = 1:5, j = 1:5) I get a segmentation fault on OSX, but not on AMD64. -- Summary: Wrong FORALL result Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dominiq at lps dot ens dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30404