re PR fortran/51991 (Wrong error message with variables named "SAVE*")

2019-06-21  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/51991
	* decl.c (gfc_match_save): If SAVE was not seen, return MATCH_NO
	instead issuing an error message and returning MATCH_ERROR.

2019-06-21  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/51991
	gfortran.dg/pr51991.f90

From-SVN: r272556
This commit is contained in:
Steven G. Kargl 2019-06-21 16:57:24 +00:00
parent 84338a1498
commit 6935293330
4 changed files with 39 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/51991
* decl.c (gfc_match_save): If SAVE was not seen, return MATCH_NO
instead issuing an error message and returning MATCH_ERROR.
2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/77632

View file

@ -9302,8 +9302,13 @@ gfc_match_save (void)
return MATCH_YES;
syntax:
gfc_error ("Syntax error in SAVE statement at %C");
return MATCH_ERROR;
if (gfc_current_ns->seen_save)
{
gfc_error ("Syntax error in SAVE statement at %C");
return MATCH_ERROR;
}
else
return MATCH_NO;
}

View file

@ -1,3 +1,8 @@
2019-06-21 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/51991
gfortran.dg/pr51991.f90
2019-06-21 Jeff Law <law@redhat.com>
PR tree-optimization/90949

View file

@ -0,0 +1,21 @@
! { dg-do compile }
! PR fortran/51991
! Orginal code contributed by Sebastien Bardeau <bardeau at iram dot fr>
module mymod
type :: mytyp
integer :: i
end type mytyp
contains
subroutine mysub
implicit none
type(mytyp) :: a
integer :: i,j
i = a%i
!
! Prior to patching gfortran, the following lined generated a syntax
! error with the SAVE statement. Now, gfortran generates an error
! that indicates 'j' is not a component of 'mytyp'.
!
j = a%j ! { dg-error "is not a member of the" }
end subroutine mysub
end module mymod