public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] fortran/66106 -- Enforce C1202 from F2008
@ 2015-05-15 15:34 Steve Kargl
  2015-05-15 15:56 ` FX
  0 siblings, 1 reply; 4+ messages in thread
From: Steve Kargl @ 2015-05-15 15:34 UTC (permalink / raw)
  To: fortran, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

Regression tested on trunk.  OK to commit?

The patch allows gfortran to check a portion of C1202
that was previously mishandled.

2015-05-XX  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66057
	* interface.c(gfc_match_end_interface): Enfornce F2008 C1202 (R1201).

2015-05-XX  Steven G. Kargl  <kargl@gcc.gnu.org>

	PR fortran/66057
	* gfortran.dg/interface_operator_1.f90: New tests.

-- 
Steve

[-- Attachment #2: pr66106.diff --]
[-- Type: text/x-diff, Size: 1274 bytes --]

Index: gcc/fortran/interface.c
===================================================================
--- gcc/fortran/interface.c	(revision 223094)
+++ gcc/fortran/interface.c	(working copy)
@@ -346,8 +346,12 @@ gfc_match_end_interface (void)
 		break;
 
 	      m = MATCH_ERROR;
-	      gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> at %C, "
-			 "but got %s", s1, s2);
+	      if (strcmp(s2, "none") == 0)
+		gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> "
+			   "at %C, ", s1);
+	      else		
+		gfc_error ("Expecting %<END INTERFACE OPERATOR (%s)%> at %C, "
+			   "but got %s", s1, s2);
 	    }
 
 	}
Index: gcc/testsuite/gfortran.dg/interface_operator_1.f90
===================================================================
--- gcc/testsuite/gfortran.dg/interface_operator_1.f90	(revision 0)
+++ gcc/testsuite/gfortran.dg/interface_operator_1.f90	(working copy)
@@ -0,0 +1,10 @@
+! { dg-do compile }
+! PR fortran/66106
+!
+! Original code from Gerhard Steinmetz
+! <gerhard dot steinmetz dot fortran at t-online dot de>
+program p
+   interface operator ( .gt. )
+   end interface operator        ! { dg-error "END INTERFACE OPERATOR" }
+end program p                    ! { dg-error "END INTERFACE" }
+! { dg-excess-errors "Unexpected end of file" }

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-05-15 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-15 15:34 [PATCH] fortran/66106 -- Enforce C1202 from F2008 Steve Kargl
2015-05-15 15:56 ` FX
2015-05-15 16:09   ` Steve Kargl
2015-05-15 18:17     ` FX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).