diff options
author | Steven G. Kargl <kargls@comcast.net> | 2005-12-12 20:13:37 +0000 |
---|---|---|
committer | Steven G. Kargl <kargl@gcc.gnu.org> | 2005-12-12 20:13:37 +0000 |
commit | d0497a6573fa4523ffbe52f20793b39f756af221 (patch) | |
tree | 7f8296ae7a013335025b997f4562e35e7a9461d9 /gcc/fortran/match.c | |
parent | 0e0ed594114997686efba9a45b8782ce87c465c3 (diff) | |
download | gcc-d0497a6573fa4523ffbe52f20793b39f756af221.zip gcc-d0497a6573fa4523ffbe52f20793b39f756af221.tar.gz gcc-d0497a6573fa4523ffbe52f20793b39f756af221.tar.bz2 |
re PR fortran/25078 (EQUILALENCE requires two or more objects)
PR fortran/25078
* match.c (gfc_match_equivalence): Count number of objects.
gfortran.dg/equiv_5.f90: New test.
From-SVN: r108426
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r-- | gcc/fortran/match.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 8ca7ed6..fd4fe33 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2599,6 +2599,7 @@ gfc_match_equivalence (void) match m; gfc_common_head *common_head = NULL; bool common_flag; + int cnt; tail = NULL; @@ -2616,6 +2617,7 @@ gfc_match_equivalence (void) set = eq; common_flag = FALSE; + cnt = 0; for (;;) { @@ -2625,6 +2627,9 @@ gfc_match_equivalence (void) if (m == MATCH_NO) goto syntax; + /* count the number of objects. */ + cnt++; + if (gfc_match_char ('%') == MATCH_YES) { gfc_error ("Derived type component %C is not a " @@ -2655,6 +2660,7 @@ gfc_match_equivalence (void) if (gfc_match_char (')') == MATCH_YES) break; + if (gfc_match_char (',') != MATCH_YES) goto syntax; @@ -2662,6 +2668,12 @@ gfc_match_equivalence (void) set = set->eq; } + if (cnt < 2) + { + gfc_error ("EQUIVALENCE at %C requires two or more objects"); + goto cleanup; + } + /* If one of the members of an equivalence is in common, then mark them all as being in common. Before doing this, check that members of the equivalence group are not in different |