From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20810 invoked by alias); 8 Jan 2007 11:23:35 -0000 Received: (qmail 20767 invoked by uid 48); 8 Jan 2007 11:23:23 -0000 Date: Mon, 08 Jan 2007 11:23:00 -0000 Message-ID: <20070108112323.20766.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/30404] Wrong FORALL result In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "pault at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-01/txt/msg00513.txt.bz2 ------- 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