This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch, fortran] PR32724 - ICE on statement function in specification part of module
- From: Daniel Franke <franke dot daniel at gmail dot com>
- To: fortran at gcc dot gnu dot org
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Sat, 14 Jul 2007 14:25:49 +0200
- Subject: [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" } }
+