Commit 721be0f4 by Steven G. Kargl

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
parent 730f6d14
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> 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 PR fortran/67885
* trans-decl.c (generate_local_decl): Mark PARAMETER entities in * trans-decl.c (generate_local_decl): Mark PARAMETER entities in
BLOCK construct. BLOCK construct.
......
...@@ -3959,7 +3959,9 @@ match_attr_spec (void) ...@@ -3959,7 +3959,9 @@ match_attr_spec (void)
break; break;
case DECL_PROTECTED: 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 " gfc_error ("PROTECTED at %C only allowed in specification "
"part of a module"); "part of a module");
......
2015-10-29 Steven G. Kargl <kargl@gcc.gnu.org> 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 PR fortran/67885
* gfortran.dg/pr67885.f90: New test. * gfortran.dg/pr67885.f90: New test.
......
! { 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
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