This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in FORALL masking condition


Mark Hesselink wrote:
> I would like to report a bug in the implementation of the FORALL 
> construct. Please consider the following code,
> 
> PROGRAM forall_1
...
>     FORALL (i=1:n:1,A(i)==1.0d0)
>        A(i)=1.0d0
>     END FORALL
> END PROGRAM forall_1
> 
> Changing the masking condition in the FORALL construct from A(i)==1.0d0 
> to A(i)/=0.0d0 makes the code compile. As far as I understand from my 
> copy of Fortran 90/95 Explained, both masking conditions should work.

This is an interesting bug.  After the matcher had seen the first '=' in
A(i)==1.0d0, it decided that this had to be a forall iterator instead of a
mask, so it couldn't make sense out of what follows.

I'm testing this patch, which fixes this testcase, and hope to have it ready
for submission tomorrow.

- Tobi

2005-06-02  Tobias Schl"uter  <tobias.schlueter@physik.uni-muenchen.de>

	* match.c (match_forall_iterator): Don't immediately give error if '='
	is not followed by an expression.
	
Index: match.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/match.c,v
retrieving revision 1.31.8.5
diff -u -p -r1.31.8.5 match.c
--- match.c     10 May 2005 23:04:45 -0000      1.31.8.5
+++ match.c     2 Jun 2005 21:11:34 -0000
@@ -3081,9 +3081,7 @@ match_forall_iterator (gfc_forall_iterat
     }

   m = gfc_match_expr (&iter->start);
-  if (m == MATCH_NO)
-    goto syntax;
-  if (m == MATCH_ERROR)
+  if (m != MATCH_YES)
     goto cleanup;

   if (gfc_match_char (':') != MATCH_YES)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]