diff mbox

fortran/66044 -- Convert ICE into ordinary error

Message ID 20150515150338.GE82729@troutmask.apl.washington.edu
State New
Headers show

Commit Message

Steve Kargl May 15, 2015, 3:03 p.m. UTC
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.

Comments

FX Coudert May 15, 2015, 8:45 p.m. UTC | #1
> 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.

OK
diff mbox

Patch

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