Commit 9bffa171 by Roger Sayle Committed by Paul Thomas

re PR fortran/30400 (ANY not accepted as mask in FORALL)

2007-02-18  Roger Sayle  <roger@eyesopen.com>
	    Paul Thomas <pault@gcc.gnu.org>

        PR fortran/30400
        * match.c (match_forall_iterator): Use gfc_match_expr instead
	of gfc_match_variable to match the iterator variable.  Return
	MATCH_NO if not a variable.  Remove the reset of the symbol's
	flavor in cleanup.

2007-02-18  Roger Sayle  <roger@eyesopen.com>

        * gfortran.dg/forall_10.f90: New test case.

Co-Authored-By: Paul Thomas <pault@gcc.gnu.org>

From-SVN: r122102
parent 078a18a4
2007-02-18 Roger Sayle <roger@eyesopen.com>
Paul Thomas <pault@gcc.gnu.org>
PR fortran/30400
* match.c (match_forall_iterator): Use gfc_match_expr instead
of gfc_match_variable to match the iterator variable. Return
MATCH_NO if not a variable. Remove the reset of the symbol's
flavor in cleanup.
2007-02-16 Tobias Burnus <burnus@net-b.de> 2007-02-16 Tobias Burnus <burnus@net-b.de>
PR fortran/30793 PR fortran/30793
......
...@@ -3358,7 +3358,10 @@ gfc_free_forall_iterator (gfc_forall_iterator *iter) ...@@ -3358,7 +3358,10 @@ gfc_free_forall_iterator (gfc_forall_iterator *iter)
/* Match an iterator as part of a FORALL statement. The format is: /* Match an iterator as part of a FORALL statement. The format is:
<var> = <start>:<end>[:<stride>][, <scalar mask>] */ <var> = <start>:<end>[:<stride>]
On MATCH_NO, the caller tests for the possibility that there is a
scalar mask expression. */
static match static match
match_forall_iterator (gfc_forall_iterator **result) match_forall_iterator (gfc_forall_iterator **result)
...@@ -3370,11 +3373,12 @@ match_forall_iterator (gfc_forall_iterator **result) ...@@ -3370,11 +3373,12 @@ match_forall_iterator (gfc_forall_iterator **result)
where = gfc_current_locus; where = gfc_current_locus;
iter = gfc_getmem (sizeof (gfc_forall_iterator)); iter = gfc_getmem (sizeof (gfc_forall_iterator));
m = gfc_match_variable (&iter->var, 0); m = gfc_match_expr (&iter->var);
if (m != MATCH_YES) if (m != MATCH_YES)
goto cleanup; goto cleanup;
if (gfc_match_char ('=') != MATCH_YES) if (gfc_match_char ('=') != MATCH_YES
|| iter->var->expr_type != EXPR_VARIABLE)
{ {
m = MATCH_NO; m = MATCH_NO;
goto cleanup; goto cleanup;
...@@ -3415,12 +3419,6 @@ syntax: ...@@ -3415,12 +3419,6 @@ syntax:
m = MATCH_ERROR; m = MATCH_ERROR;
cleanup: cleanup:
/* Make sure that potential internal function references in the
mask do not get messed up. */
if (iter->var
&& iter->var->expr_type == EXPR_VARIABLE
&& iter->var->symtree->n.sym->refs == 1)
iter->var->symtree->n.sym->attr.flavor = FL_UNKNOWN;
gfc_current_locus = where; gfc_current_locus = where;
gfc_free_forall_iterator (iter); gfc_free_forall_iterator (iter);
......
2007-02-18 Roger Sayle <roger@eyesopen.com>
* gfortran.dg/forall_10.f90: New test case.
2007-02-18 Eric Botcazou <ebotcazou@adacore.com> 2007-02-18 Eric Botcazou <ebotcazou@adacore.com>
* gnat.dg/tail_call_p.ads, tail_call_p.adb, tail_call.adb: New test. * gnat.dg/tail_call_p.ads, tail_call_p.adb, tail_call.adb: New test.
! { dg-do run }
! { dg-options "-O" }
! Tests the fix for PR30400, in which the use of ANY in the
! FORALL mask was rejected.
!
! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
!
program pr30400_1
real, dimension (5, 5, 5, 5) :: a
a (:, :, :, :) = 4
a (:, 2, :, 4) = 10
a (:, 2, :, 1) = 0
forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k, :) .gt. 6))
forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
a (i, j, k, l) = i - j + k - l
end forall
end forall
if (sum (a) .ne. 2625.0) call abort ()
! Check that the fix has not broken the treatment of the '=='
forall (i = 1:5, i == 3) a(i, i, i, i) = -5
if (sum (a) .ne. 2616.0) call abort ()
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment