re PR fortran/68054 (ICE on using protected attribute in program without program statement)

2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/68054
	* decl.c (match_attr_spec): PROTECTED can only be a module.

2015-10-29  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/68054
	* gfortran.dg/pr68054.f90: New test.

From-SVN: r229542
This commit is contained in:
Steven G. Kargl 2015-10-29 17:23:52 +00:00
parent 730f6d1425
commit 721be0f47c
4 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68054
* decl.c (match_attr_spec): PROTECTED can only be a module.
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67885

View File

@ -3959,7 +3959,9 @@ match_attr_spec (void)
break;
case DECL_PROTECTED:
if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE)
if (gfc_current_state () != COMP_MODULE
|| (gfc_current_ns->proc_name
&& gfc_current_ns->proc_name->attr.flavor != FL_MODULE))
{
gfc_error ("PROTECTED at %C only allowed in specification "
"part of a module");

View File

@ -1,3 +1,8 @@
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/68054
* gfortran.dg/pr68054.f90: New test.
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/67885

View File

@ -0,0 +1,8 @@
! { dg-do compile }
! PR fortran/68054
! Original code contributed by Gerhard Steinmetz
! gerhard dot steinmetz dot fortran at t-online dot de
!
!program p
real, protected :: x ! { dg-error "only allowed in specification" }
end