This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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/66057 -- detect malformed GENERIC statement


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

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