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
+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
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");
+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
--- /dev/null
+! { 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