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]

[gfortran] Fix for fixed-form parser



We didn't correctly handle the case of a fixed-form line with a zero in column 6. This is not a continuation line by section 3.3.2.3 of the (draft) Fortran 95 standard. This patch (ported from Andy's tree) fixes this. Bootstrapped and regtested on i686-pc-linux. This also passed Steve Kargl's testsuite with no new failures. 'compile' testcase attached (I upgraded mozilla in the meantime :-).


- Tobi

2004-04-22 Tobias Schlüter <tobias.schlueter@physik.uni-muenchen.de>

	* parse.c (gfc_statement_next_fixed): (Change from Andy's tree)
	Detect bad continuation	line in fixed form sources.

Index: parse.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/fortran/Attic/parse.c,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 parse.c
--- parse.c	1 Jan 2004 12:09:12 -0000	1.1.2.4
+++ parse.c	8 May 2004 16:18:57 -0000
@@ -420,18 +420,27 @@ next_fixed (void)
     }

   /* Since this line starts a statement, it cannot be a continuation
-     of a previous statement.  Hence we mostly ignore column 6.  */
+     of a previous statement.  If we see something here besides a
+     space or zero, it must be a bad continuation line.  */

-  if (gfc_next_char_literal (0) == '\n')
+  c = gfc_next_char_literal (0);
+  if (c == '\n')
     goto blank_line;

+  if (c != ' ' && c != '0')
+    {
+      gfc_buffer_error (0);
+      gfc_error ("Bad continuation line at %C");
+      return ST_NONE;
+    }
+
   /* Now that we've taken care of the statement label columns, we have
      to make sure that the first nonblank character is not a '!'.  If

! verifies that 0 in column six doesn't start a continuation line
!234567890
     0 END

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