diff options
author | Janus Weil <janus@gcc.gnu.org> | 2018-08-22 21:31:40 +0200 |
---|---|---|
committer | Janus Weil <janus@gcc.gnu.org> | 2018-08-22 21:31:40 +0200 |
commit | bcddf743dd356082eca0a580881da0df683fe5ea (patch) | |
tree | aa45f8344f1f2d4f0e9854e2aafb26852eda8478 /gcc/fortran/match.c | |
parent | e9afbed0d65d7546b05cce3d5b5229b0046933ed (diff) | |
download | gcc-bcddf743dd356082eca0a580881da0df683fe5ea.zip gcc-bcddf743dd356082eca0a580881da0df683fe5ea.tar.gz gcc-bcddf743dd356082eca0a580881da0df683fe5ea.tar.bz2 |
re PR fortran/86935 (Bad locus in ASSOCIATE statement)
fix PR 86935
2018-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/86935
* match.c (gfc_match_associate): Improve diagnostics for the ASSOCIATE
statement.
2018-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/86935
* gfortran.dg/associate_3.f90: Update error message.
* gfortran.dg/associate_39.f90: New test case.
From-SVN: r263787
Diffstat (limited to 'gcc/fortran/match.c')
-rw-r--r-- | gcc/fortran/match.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index 1ab0e0f..85247dd8 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -1889,17 +1889,21 @@ gfc_match_associate (void) gfc_association_list* a; /* Match the next association. */ - if (gfc_match (" %n => %e", newAssoc->name, &newAssoc->target) - != MATCH_YES) + if (gfc_match (" %n =>", newAssoc->name) != MATCH_YES) + { + gfc_error ("Expected association at %C"); + goto assocListError; + } + + if (gfc_match (" %e", &newAssoc->target) != MATCH_YES) { /* Have another go, allowing for procedure pointer selectors. */ gfc_matching_procptr_assignment = 1; - if (gfc_match (" %n => %e", newAssoc->name, &newAssoc->target) - != MATCH_YES) - { - gfc_error ("Expected association at %C"); - goto assocListError; - } + if (gfc_match (" %e", &newAssoc->target) != MATCH_YES) + { + gfc_error ("Invalid association target at %C"); + goto assocListError; + } gfc_matching_procptr_assignment = 0; } newAssoc->where = gfc_current_locus; |