This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] fortran/66044 -- Convert ICE into ordinary error


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]