Commit bcddf743 by Janus Weil

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
parent e9afbed0
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()
......
......@@ -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;
......
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
* gfortran.dg/alloc_comp_basics_6.f90: Update an error message and add
an additional case.
......
......@@ -13,7 +13,7 @@ PROGRAM main
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" }
......
! { 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
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