[RFC] PR fortran/20839

Steven Bosscher stevenb@suse.de
Sun Nov 13 15:30:00 GMT 2005


Hi,

This should fix PR20839.  But I don't like the diagnostic this way,
does anyone have suggestions for a more understandable message?

Gr.
Steven


	PR fortran/20839
	* parse.c (parse_do_block): Diagnose missing ENDDO statements
	for named DO constructs.

Index: parse.c
===================================================================
--- parse.c	(revision 106784)
+++ parse.c	(working copy)
@@ -23,6 +23,7 @@ Software Foundation, 51 Franklin Street,
 
 #include "config.h"
 #include "system.h"
+#include "flags.h"
 #include <setjmp.h>
 #include "gfortran.h"
 #include "match.h"
@@ -2057,6 +2058,14 @@ parse_do_block
       break;
 
     case ST_IMPLIED_ENDDO:
+      /* If the do-stmt of this DO construct has a do-construct-name,
+	 the corresponding end-do must be an end-do-stmt (with a matching
+	 name, but in that case we must have seen ST_ENDDO first).
+         We only complain about this in pedantic mode.  */
+      if (pedantic && gfc_current_block () != NULL)
+	gfc_error_now
+	  ("Named DO construct at %L has no matching named ENDDO statement",
+	   &gfc_current_block()->declared_at);
       break;
 
     default:



More information about the Fortran mailing list