+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 Andrew Benson <abensonca@gmail.com>
* module.c (load_generic_interfaces): Move call to find_symbol()
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;
+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.
+
2018-08-22 Janus Weil <janus@gcc.gnu.org>
PR fortran/86888
ASSOCIATE (a => 1) 5 ! { dg-error "Junk after ASSOCIATE" }
- ASSOCIATE (x =>) ! { dg-error "Expected association" }
+ ASSOCIATE (x =>) ! { dg-error "Invalid association target" }
ASSOCIATE (=> 5) ! { dg-error "Expected association" }
--- /dev/null
+! { dg-do compile }
+!
+! PR 86935: Bad locus in ASSOCIATE statement
+!
+! Contributed by Janus Weil <janus@gcc.gnu.org>
+
+implicit none
+
+type :: t
+ real :: r = 0.5
+ integer :: i = 3
+end type
+
+type(t) :: x
+
+associate (r => x%r, &
+ i => x%ii) ! { dg-error "Invalid association target" }
+
+end