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] PR32724 - ICE on statement function in specification part of module


On Paul's behalf:


2007-07-14  Paul Thomas  <pault@gcc.gnu.org>

	PR fortran/32724
	* parse.c (parse_spec): Emit error on unexpected statement function.


Regression tested on i686-pc-linux-gnu by myself. 
Ok for trunk?

Regards
	Daniel
Index: fortran/parse.c
===================================================================
--- fortran/parse.c	(revision 126614)
+++ fortran/parse.c	(working copy)
@@ -1902,6 +1902,13 @@
 
 	  break;
 
+	case ST_STATEMENT_FUNCTION:
+	  if (gfc_current_state () == COMP_MODULE)
+	    {
+	      unexpected_statement (st);
+	      break;
+	    }
+
 	default:
 	  break;
 	}
Index: testsuite/gfortran.dg/stfunc_5.f90
===================================================================
--- testsuite/gfortran.dg/stfunc_5.f90	(revision 0)
+++ testsuite/gfortran.dg/stfunc_5.f90	(revision 0)
@@ -0,0 +1,11 @@
+! { dg-do compile }
+!
+! PR fortran/32724
+! ICE on statement function in specification part of module
+
+MODULE stmt
+f(x) = x**2      ! { dg-error "Unexpected STATEMENT FUNCTION" }
+END MODULE
+
+! { dg-final { cleanup-modules "stmt" } }
+

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