This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[PATCH] fortran/66044 -- Convert ICE into ordinary error
- From: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
- To: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Fri, 15 May 2015 08:03:38 -0700
- Subject: [PATCH] fortran/66044 -- Convert ICE into ordinary error
- Authentication-results: sourceware.org; auth=none
Regression tested on trunk. OK to commit?
Poorly written code could invoke an ICE when an ordinary
error could have been emitted.
2015-05-XX Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66044
* decl.c(gfc_match_entry): Change a gfc_internal_error() into
a gfc_error()
2015-05-XX Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66044
* gfortran.dg/entry_21.f90: New test.
--
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 223094)
+++ gcc/fortran/decl.c (working copy)
@@ -5592,7 +5592,7 @@ gfc_match_entry (void)
"a contained subprogram");
break;
default:
- gfc_internal_error ("gfc_match_entry(): Bad state");
+ gfc_error ("Unexpected ENTRY statement at %C");
}
return MATCH_ERROR;
}
Index: gcc/testsuite/gfortran.dg/entry_21.f90
===================================================================
--- gcc/testsuite/gfortran.dg/entry_21.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/entry_21.f90 (working copy)
@@ -0,0 +1,17 @@
+! { dg-do compile }
+! PR fortran/66044
+!
+! Original code from Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+subroutine p
+end subroutine p
+
+entry e ! { dg-error "Unexpected ENTRY statement" }
+end
+
+module m
+ type t
+ contains
+ entry e ! { dg-error "Unexpected ENTRY statement" }
+ end type
+end module m