Commit 73641c88 by Steven G. Kargl

re PR fortran/66052 (Segmentation fault for misplaced protected statement)

2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66052
	* decl.c(gfc_match_protected): Prevent dereference of NULL pointer. 

2015-05-18  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66052
	* gfortran.dg/protected_9.f90: New test.

From-SVN: r223324
parent bfeeb145
......@@ -5,6 +5,11 @@
2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66043
* gfortran.dg/storage_size_6.f90: New tests.
2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66044
* decl.c(gfc_match_entry): Change a gfc_internal_error() into
a gfc_error()
......
......@@ -6968,7 +6968,8 @@ gfc_match_protected (void)
gfc_symbol *sym;
match m;
if (gfc_current_ns->proc_name->attr.flavor != FL_MODULE)
if (!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-05-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66043
* gfortran.dg/storage_size_6.f90: New tests.
2015-05-18 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66045
* gfortran.dg/null1.f90: New test.
......
! { dg-do compile }
! PR fortran/66052
!
!
! Original code from Gerhard Steinmetz
! <gerhard dot steinmetz dot fortran at t-online dot de>
module a
contains
protected x ! { dg-error "only allowed in specification part" }
end module a
program p
contains
protected x ! { dg-error "only allowed in specification part" }
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