[gfortran] give better loci for errors in end statements

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon Dec 6 18:53:00 GMT 2004


Fixed-form code like this
       do i=1,2
       end
gives an error message with the caret pointing to column 72, as the current
locus is used after matching the end of statement (i.e. the newline).

This patch changes this to use the locus where the end was originally matched.

Bubblestrapped and regtested. Ok? Is there a way stuff like this can be tested
in the testsuite?

- Tobi

2004-12-06  Tobias Schlueter  <tobias.shclueter@physik.uni-muenchen.de>

	* decl.c (gfc_match_end): Use locus of END when eos is an error.

Index: decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/decl.c,v
retrieving revision 1.26
diff -u -p -r1.26 decl.c
--- decl.c      8 Nov 2004 14:56:37 -0000       1.26
+++ decl.c      6 Dec 2004 18:52:59 -0000
@@ -2576,8 +2576,8 @@ gfc_match_end (gfc_statement * st)
       if (!eos_ok)
        {
          /* We would have required END [something]  */
-         gfc_error ("%s statement expected at %C",
-                    gfc_ascii_statement (*st));
+         gfc_error ("%s statement expected at %L",
+                    gfc_ascii_statement (*st), &old_loc);
          goto cleanup;
        }





More information about the Fortran mailing list