This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/30404] Wrong FORALL result
- From: "pault at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jan 2007 11:23:23 -0000
- Subject: [Bug fortran/30404] Wrong FORALL result
- References: <bug-30404-12313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pault at gcc dot gnu dot org 2007-01-08 11:23 -------
There appears to be a double problem here; the segfault, which I can reproduce
by adding more statements in the forall block that sets a, and the incorrect
rendering of the mask logic, according to where the masking is applied.
The program below illustrates the problem more simply.
I have cc'd Roger Sayle.
Paul
integer, dimension (3, 3) :: a, b, c
logical, dimension (3,3) :: l1 = .FALSE.
integer :: i, j
a = 2
a (1,1) = 1
a (3,3) = 1
a (2,1) = 3
a (2,3) = 3
b = a
c = a
forall (i = 1:3, a(i, 1) == 1) ! mask true for i = 1
forall (j = 1:3, a(2, j) == 3) ! mask true for j = 1,3
b (i, j) = 99 ! set for (i = 1) && (j = 1,3)
l1 (i, j) = .TRUE.
end forall
end forall
forall (i = 1:3, a(i, 1) .lt. 1000)
forall (j = 1:3, l1(i, j)) ! mask true for (i = 1) && (j = 1,3)
c (i, j) = 99 ! SHOULD be set for (i = 1) && (j = 1,3)
end forall
end forall
! forall (i = 1:3) ! this segfaults
forall (i = 1:3, a(i, 1) .lt. 1000)
forall (j = 1:3, &
(a(i, 1) == 1 .and. a(2, j) == 3)) ! mask true for (i = 1) && (j = 1,3)
a (i, j) = 99 ! SHOULD be set for (i = 1) && (j = 1,3)
end forall
end forall
print *, a ! a remains unchanged for gfortran
print *, b ! b is changed correctly
print *, c ! c(2,:) == 99 *sigh*
! Other compilers end up with a == b == c
end
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |sayle at gcc dot gnu dot org
Status|UNCONFIRMED |NEW
Ever Confirmed|0 |1
Last reconfirmed|0000-00-00 00:00:00 |2007-01-08 11:23:23
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30404