This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] fortran/66057 -- detect malformed GENERIC statement
- 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:23:45 -0700
- Subject: [PATCH] fortran/66057 -- detect malformed GENERIC statement
- Authentication-results: sourceware.org; auth=none
Regression tested on trunk. OK to commit?
See the test case for the type of error that this patch
catches.
2015-05-XX Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66057
* decl.c(gfc_match_generic): Detected a malformed GENERIC statement.
2015-05-XX Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/66057
* gfortran.dg/generic_29.f90: New tests.
--
Steve
Index: gcc/fortran/decl.c
===================================================================
--- gcc/fortran/decl.c (revision 223094)
+++ gcc/fortran/decl.c (working copy)
@@ -8510,6 +8511,11 @@ gfc_match_generic (void)
gfc_op2string (op));
break;
+ case INTERFACE_NAMELESS:
+ gfc_error ("Malformed GENERIC statement at %C");
+ goto error;
+ break;
+
default:
gcc_unreachable ();
}
Index: gcc/testsuite/gfortran.dg/generic_29.f90
===================================================================
--- gcc/testsuite/gfortran.dg/generic_29.f90 (revision 0)
+++ gcc/testsuite/gfortran.dg/generic_29.f90 (working copy)
@@ -0,0 +1,11 @@
+! { dg-do compile}
+! PR fortran/66057
+!
+! Original code from Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+program p
+ type t
+ contains
+ generic :: ! { dg-error "Malformed GENERIC" }
+ end type
+end