diff options
author | Roger Sayle <roger@eyesopen.com> | 2007-02-18 19:52:16 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2007-02-18 19:52:16 +0000 |
commit | 9bffa1718a6f2edeeec1aec1f4afef0ff69584ce (patch) | |
tree | 3f2fa297f1a33544a955895add48c12f2b3ee9e3 /gcc | |
parent | 078a18a42304f0caa644fb42c37b55fc59673d00 (diff) | |
download | gcc-9bffa1718a6f2edeeec1aec1f4afef0ff69584ce.zip gcc-9bffa1718a6f2edeeec1aec1f4afef0ff69584ce.tar.gz gcc-9bffa1718a6f2edeeec1aec1f4afef0ff69584ce.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/ChangeLog | 9 | ||||
-rw-r--r-- | gcc/fortran/match.c | 16 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/forall_10.f90 | 25 |
4 files changed, 45 insertions, 9 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 02ba34f..43c10ee 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +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> PR fortran/30793 diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 941e625..bf78911 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -3358,7 +3358,10 @@ gfc_free_forall_iterator (gfc_forall_iterator *iter) /* 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 match_forall_iterator (gfc_forall_iterator **result) @@ -3370,11 +3373,12 @@ match_forall_iterator (gfc_forall_iterator **result) where = gfc_current_locus; iter = gfc_getmem (sizeof (gfc_forall_iterator)); - m = gfc_match_variable (&iter->var, 0); + m = gfc_match_expr (&iter->var); if (m != MATCH_YES) goto cleanup; - if (gfc_match_char ('=') != MATCH_YES) + if (gfc_match_char ('=') != MATCH_YES + || iter->var->expr_type != EXPR_VARIABLE) { m = MATCH_NO; goto cleanup; @@ -3415,12 +3419,6 @@ syntax: m = MATCH_ERROR; 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_free_forall_iterator (iter); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 13745a0..5870a68 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2007-02-18 Roger Sayle <roger@eyesopen.com> + + * gfortran.dg/forall_10.f90: New test case. + 2007-02-18 Eric Botcazou <ebotcazou@adacore.com> * gnat.dg/tail_call_p.ads, tail_call_p.adb, tail_call.adb: New test. diff --git a/gcc/testsuite/gfortran.dg/forall_10.f90 b/gcc/testsuite/gfortran.dg/forall_10.f90 new file mode 100644 index 0000000..1b16840 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/forall_10.f90 @@ -0,0 +1,25 @@ +! { 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 |