public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
@ 2004-07-11 13:19 Tobias Schlüter
  2004-07-11 13:34 ` Tobias Schlüter
  2004-07-11 14:49 ` Paul Brook
  0 siblings, 2 replies; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-11 13:19 UTC (permalink / raw)
  To: GCC Fortran mailing list, patch


Trivial fix for that bug.

Built and verified that it works as expected. I didn't commit this as
obvious, because someone might prefer if we allowed arbitrary line
lengths, as in -ffixed-line-length-N, where N is an arbitrary positive
integer. I can't see much value in that, but there might be.

- Tobi

Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/lang.opt,v
retrieving revision 1.4
diff -u -p -r1.4 lang.opt
--- lang.opt    22 May 2004 11:03:17 -0000      1.4
+++ lang.opt    11 Jul 2004 12:22:06 -0000
@@ -97,6 +97,10 @@ fimplicit-none
 F95
 Specify that no implicit typing is allowed, unless overridden by
explicit IMPLICIT statements

+ffixed-line-length-72
+F95 RejectNegative
+Use 72 character line width in fixed mode
+
 ffixed-line-length-80
 F95 RejectNegative
 Use 80 character line width in fixed mode
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.5
diff -u -p -r1.5 options.c
--- options.c   22 May 2004 11:03:17 -0000      1.5
+++ options.c   11 Jul 2004 12:22:06 -0000
@@ -260,6 +260,10 @@ gfc_handle_option (size_t scode, const c
       gfc_option.flag_repack_arrays = value;
       break;

+    case OPT_ffixed_line_length_72:
+      gfc_option.fixed_line_length = 72;
+      break;
+
     case OPT_ffixed_line_length_80:
       gfc_option.fixed_line_length = 80;
       break;

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-11 13:19 [gofrtran] Fix PR 16465: accept -ffixed-line-length-72 Tobias Schlüter
@ 2004-07-11 13:34 ` Tobias Schlüter
  2004-07-11 14:49 ` Paul Brook
  1 sibling, 0 replies; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-11 13:34 UTC (permalink / raw)
  To: GCC Fortran mailing list; +Cc: patch

Tobias Schlüter wrote:
> Trivial fix for that bug.

Trivial ChangeLog:
2004-07-11  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de

	PR fortran/16465
	* lang.opt (ffixed-line-length-72): New option.
	* options.c (gfc_handle_option): Handle option.

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-11 13:19 [gofrtran] Fix PR 16465: accept -ffixed-line-length-72 Tobias Schlüter
  2004-07-11 13:34 ` Tobias Schlüter
@ 2004-07-11 14:49 ` Paul Brook
  2004-07-11 23:15   ` Tobias Schlüter
  1 sibling, 1 reply; 13+ messages in thread
From: Paul Brook @ 2004-07-11 14:49 UTC (permalink / raw)
  To: fortran; +Cc: Tobias Schlüter, patch

On Sunday 11 July 2004 13:29, Tobias Schlüter wrote:
> Trivial fix for that bug.
>
> Built and verified that it works as expected. I didn't commit this as
> obvious, because someone might prefer if we allowed arbitrary line
> lengths, as in -ffixed-line-length-N, where N is an arbitrary positive
> integer. I can't see much value in that, but there might be.

The documentation (fortran/invoke.texi) implies that any value is allowed, so 
either the code or the documentation needs fixing.

g77 supports arbitary lengths, so we probably should too.

You might want to fix -ffixed-line-length-none at the same time:)

Paul

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-11 14:49 ` Paul Brook
@ 2004-07-11 23:15   ` Tobias Schlüter
  2004-07-12 22:49     ` Toon Moene
  0 siblings, 1 reply; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-11 23:15 UTC (permalink / raw)
  To: Paul Brook; +Cc: fortran, patch

Paul Brook wrote:
> The documentation (fortran/invoke.texi) implies that any value is allowed, so 
> either the code or the documentation needs fixing.

Done as below. There is a difference from g77: g77 pads strings on
continued lines, i.e.
      t = "STRING
     1TEST"
will let t have a bunch of spaces between "STRING" and "TEST". We don't
do this, but since we never did, and noone complained, I guess that's no
issue.

> 
> g77 supports arbitary lengths, so we probably should too.

If someone complains, I will.

> 
> You might want to fix -ffixed-line-length-none at the same time:)

Done. Modulo the arbitrary linelengths :-)

Built on i686-pc-linux, I also checked that the new options work.

- Tobi

Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/invoke.texi,v
retrieving revision 1.4
diff -u -p -r1.4 invoke.texi
--- invoke.texi 4 Jul 2004 09:01:40 -0000       1.4
+++ invoke.texi 11 Jul 2004 18:35:23 -0000
@@ -191,26 +191,25 @@ older Fortran programs.
 @cindex character set
 Allow @samp{$} as a valid character in a symbol name.

-@cindex -ffixed-line-length-@var{n} option
-@cindex options, -ffixed-line-length-@var{n}
-@item -ffixed-line-length-@var{n}
+@cindex -ffixed-line-length-none option
+@cindex options, -ffixed-line-length-none
+@item -ffixed-line-length-none
 @cindex source file format
 @cindex lines, length
 @cindex length of source lines
 @cindex fixed form
 @cindex limits, lengths of source lines
 Set column after which characters are ignored in typical fixed-form
-lines in the source file, and through which spaces are assumed (as
-if padded to that length) after the ends of short fixed-form lines.
+lines in the source to the maximum value supported by
+@command{gfortran}, which by default is 132.

 @cindex card image
 @cindex extended-source option
 Popular values for @var{n} include 72 (the
 standard and the default), 80 (card image), and 132 (corresponds
 to ``extended-source'' options in some popular compilers).
-@var{n} may be @samp{none}, meaning that the entire line is meaningful
-and that continued character constants never have implicit spaces appended
-to them to fill out the line.
+@var{n} may be @samp{none}, meaning the maximum value will be
+assumed. This value is a build-time constant and defaults to 132.
 @option{-ffixed-line-length-0} means the same thing as
 @option{-ffixed-line-length-none}.

Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/lang.opt,v
retrieving revision 1.6
diff -u -p -r1.6 lang.opt
--- lang.opt    11 Jul 2004 16:55:00 -0000      1.6
+++ lang.opt    11 Jul 2004 18:35:23 -0000
@@ -97,13 +97,13 @@ fimplicit-none
 F95
 Specify that no implicit typing is allowed, unless overridden by
explicit IMPLICIT statements

-ffixed-line-length-80
+ffixed-line-length-none
 F95 RejectNegative
-Use 80 character line width in fixed mode
+Use maximum supported character line width in fixed mode

-ffixed-line-length-132
-F95 RejectNegative
-Use 132 character line width in fixed mode
+ffixed-line-length-
+F95 RejectNegative Joined UInteger
+-ffixed-line-length-<n>                Use n as character line width in
fixed mode

 fmax-identifier-length=
 F95 RejectNegative Joined UInteger
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.7
diff -u -p -r1.7 options.c
--- options.c   11 Jul 2004 16:55:00 -0000      1.7
+++ options.c   11 Jul 2004 18:35:23 -0000
@@ -260,12 +260,17 @@ gfc_handle_option (size_t scode, const c
       gfc_option.flag_repack_arrays = value;
       break;

-    case OPT_ffixed_line_length_80:
-      gfc_option.fixed_line_length = 80;
-      break;
-
-    case OPT_ffixed_line_length_132:
-      gfc_option.fixed_line_length = 132;
+    case OPT_ffixed_line_length_none:
+      value = GFC_MAX_LINE;
+      /* Fall through ...  */
+
+    case OPT_ffixed_line_length_:
+      if (value == 0)
+       value = GFC_MAX_LINE;
+      if (value > GFC_MAX_LINE)
+       gfc_fatal_error ("Maximum supported line length is %d",
+                        GFC_MAX_LINE);
+      gfc_option.fixed_line_length = value;
       break;

     case OPT_fmax_identifier_length_:

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-11 23:15   ` Tobias Schlüter
@ 2004-07-12 22:49     ` Toon Moene
  2004-07-12 23:16       ` Tobias Schlüter
  2004-07-13  1:43       ` Tobias Schlüter
  0 siblings, 2 replies; 13+ messages in thread
From: Toon Moene @ 2004-07-12 22:49 UTC (permalink / raw)
  To: Tobias Schlüter; +Cc: Paul Brook, fortran, patch

Tobias Schlüter wrote:

> Paul Brook wrote:
> 
>>The documentation (fortran/invoke.texi) implies that any value is allowed, so 
>>either the code or the documentation needs fixing.
> 
> 
> Done as below. There is a difference from g77: g77 pads strings on
> continued lines, i.e.
>       t = "STRING
>      1TEST"
> will let t have a bunch of spaces between "STRING" and "TEST". We don't
> do this, but since we never did, and noone complained, I guess that's no
> issue.

Not so fast - this is fixed form code, so every line is 72 characters 
long.  g77 was quite innovative in treating this right - IIRC, DEC 
changed its compiler to match g77's behaviour.

-- 
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-12 22:49     ` Toon Moene
@ 2004-07-12 23:16       ` Tobias Schlüter
  2004-07-12 23:21         ` Steve Kargl
  2004-07-13  1:43       ` Tobias Schlüter
  1 sibling, 1 reply; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-12 23:16 UTC (permalink / raw)
  To: Toon Moene; +Cc: Paul Brook, fortran, patch

Toon Moene wrote:
>>Done as below. There is a difference from g77: g77 pads strings on
>>continued lines, i.e.
>>      t = "STRING
>>     1TEST"
>>will let t have a bunch of spaces between "STRING" and "TEST". We don't
>>do this, but since we never did, and noone complained, I guess that's no
>>issue.
> 
> 
> Not so fast - this is fixed form code, so every line is 72 characters 
> long.  g77 was quite innovative in treating this right - IIRC, DEC 
> changed its compiler to match g77's behaviour.
> 

Hm, g77 came out sometime in the 90ies, and this feature was an
innovation? I can't believe many people rely on this.

I guess this counts as a complaint, I will update my patch.

- Tobi

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-12 23:16       ` Tobias Schlüter
@ 2004-07-12 23:21         ` Steve Kargl
  0 siblings, 0 replies; 13+ messages in thread
From: Steve Kargl @ 2004-07-12 23:21 UTC (permalink / raw)
  To: Tobias Schl?ter; +Cc: Toon Moene, Paul Brook, fortran, patch

On Mon, Jul 12, 2004 at 09:26:49PM +0200, Tobias Schl?ter wrote:
> Toon Moene wrote:
> >>Done as below. There is a difference from g77: g77 pads strings on
> >>continued lines, i.e.
> >>      t = "STRING
> >>     1TEST"
> >>will let t have a bunch of spaces between "STRING" and "TEST". We don't
> >>do this, but since we never did, and noone complained, I guess that's no
> >>issue.
> > 
> > 
> > Not so fast - this is fixed form code, so every line is 72 characters 
> > long.  g77 was quite innovative in treating this right - IIRC, DEC 
> > changed its compiler to match g77's behaviour.
> > 
> 
> Hm, g77 came out sometime in the 90ies, and this feature was an
> innovation? I can't believe many people rely on this.
> 
> I guess this counts as a complaint, I will update my patch.
> 

I'm not complaining, just offering a data point with NAG's compiler
and its dusty deck option.

troutmask:kargl[203] cat a.f
      program a
      character*100 t
      t = "STRING
     1TEST"
      print *, t
      end
troutmask:kargl[204] f95 -dusty -o a a.f
Obsolescent: a.f, line 1: Fixed source form
troutmask:kargl[205] ./a
 STRING                                                       TEST                                   


-- 
Steve

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-12 22:49     ` Toon Moene
  2004-07-12 23:16       ` Tobias Schlüter
@ 2004-07-13  1:43       ` Tobias Schlüter
  2004-07-13  6:41         ` Bud Davis
  1 sibling, 1 reply; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-13  1:43 UTC (permalink / raw)
  To: Toon Moene; +Cc: Paul Brook, fortran, patch

Toon Moene wrote:
> 
> Not so fast - this is fixed form code, so every line is 72 characters 
> long.  g77 was quite innovative in treating this right - IIRC, DEC 
> changed its compiler to match g77's behaviour.
> 

I've updated my patch. But before I post it, I want to know: Is support
for arbitrary line lengths with --fixed-line-length-none also a must, or
is the builtin maximum of 132 ok? I just don't want to do that work
unnecessarily.

For writing a testcase, I'm interested in this: is there a way to
compile and run a testcase with several different options, and expect
different output each time, i.e.
	character(400) :: t
        t=
       1"
       2a"
        print *, len_trim(t)+6
        end
has this behavior:
option --ffixed-line-length-72   -> prints: 72
option --ffixed-line-length-132  -> prints: 132
option --ffixed-line-length-none -> prints: 7
etc.

- Tobi

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-13  1:43       ` Tobias Schlüter
@ 2004-07-13  6:41         ` Bud Davis
  2004-07-13  8:12           ` Tobias Schlüter
  0 siblings, 1 reply; 13+ messages in thread
From: Bud Davis @ 2004-07-13  6:41 UTC (permalink / raw)
  To: Tobias Schlüter; +Cc: Toon Moene, Paul Brook, gfortran, patch

On Mon, 2004-07-12 at 17:23, Tobias Schlüter wrote:

> I've updated my patch. But before I post it, I want to know: Is
support
> for arbitrary line lengths with --fixed-line-length-none also a must, 

yes. 

i have used this feature in g7, not with human written code, but with
code written by programs.  

  

--bud
 

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-13  6:41         ` Bud Davis
@ 2004-07-13  8:12           ` Tobias Schlüter
  2004-07-13 20:50             ` Tobias Schlüter
  0 siblings, 1 reply; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-13  8:12 UTC (permalink / raw)
  To: Bud Davis; +Cc: Toon Moene, Paul Brook, gfortran, patch

Bud Davis wrote:
> On Mon, 2004-07-12 at 17:23, Tobias Schlüter wrote:
>>I've updated my patch. But before I post it, I want to know: Is support
>>for arbitrary line lengths with --fixed-line-length-none also a must, 
> 
> yes. 
> 
> i have used this feature in g77, not with human written code, but with
> code written by programs.  
> 

Argh! Ok, will do so tomorrow.

- Tobi

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-13  8:12           ` Tobias Schlüter
@ 2004-07-13 20:50             ` Tobias Schlüter
  2004-07-19  4:21               ` Paul Brook
  0 siblings, 1 reply; 13+ messages in thread
From: Tobias Schlüter @ 2004-07-13 20:50 UTC (permalink / raw)
  To: Tobias Schlüter; +Cc: Bud Davis, Toon Moene, Paul Brook, gfortran, patch

Tobias Schlüter wrote:
> Bud Davis wrote:
> 
>>On Mon, 2004-07-12 at 17:23, Tobias Schlüter wrote:
>>
>>>I've updated my patch. But before I post it, I want to know: Is support
>>>for arbitrary line lengths with --fixed-line-length-none also a must, 
>>
>>yes. 
>>
>>i have used this feature in g77, not with human written code, but with
>>code written by programs.  
>>
> 
> 
> Argh! Ok, will do so tomorrow.
> 

Updated patch below. There are no changes to invoke.texi because the
functionality is as documented now (except that the case in which no
meaningful Fortran program can be written, -ffixed-line-length-6 and
below, is not documented. I don't think that's a real omission)

There is a bug, but I verified that this is also present before my
patch: newlines inside statements confuse the parser. This is the reason
the g77 testcase ffixed-line-length-7.f doesn't work. I haven't yet
looked into how to fix this, and I think it is fairly orthogonal to this
patch. Apart from that one, I plan to commit the ffixed-line-length
tests from the g77 testsuite alongside this patch.

This also fixes a bug we had in the handling of preprocessor lines:
overlong preprocessor lines would get written to unallocated memory,
this is fixed by appropriately resizing the line buffer along the way.

- Tobi

2004-07-13  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	PR fortran/16465
	* lang.opt (ffixed-line-length-none, ffixed-line-length-): New
	options.
	(ffixed-line-length-80, ffixed-line-length-132): Remove.
	* options.c (gfc_handle_options): Deal with changed options.
	* scanner.c (load_line): Change second arg to 'char **',
	allocate if pointing to NULL. Keep track of buffer's length.
	Adapt buffer size to overlong lines. Pad lines to full length
	in fixed form.
	(load_file): Adapt to new interface of load_line.

Index: lang.opt
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/lang.opt,v
retrieving revision 1.6
diff -u -p -r1.6 lang.opt
--- lang.opt    11 Jul 2004 16:55:00 -0000      1.6
+++ lang.opt    13 Jul 2004 13:15:13 -0000
@@ -97,13 +97,13 @@ fimplicit-none
 F95
 Specify that no implicit typing is allowed, unless overridden by
explicit IMPLICIT statements

-ffixed-line-length-80
+ffixed-line-length-none
 F95 RejectNegative
-Use 80 character line width in fixed mode
+Use maximum supported character line width in fixed mode

-ffixed-line-length-132
-F95 RejectNegative
-Use 132 character line width in fixed mode
+ffixed-line-length-
+F95 RejectNegative Joined UInteger
+-ffixed-line-length-<n>                Use n as character line width in
fixed mode

 fmax-identifier-length=
 F95 RejectNegative Joined UInteger
Index: options.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/options.c,v
retrieving revision 1.7
diff -u -p -r1.7 options.c
--- options.c   11 Jul 2004 16:55:00 -0000      1.7
+++ options.c   13 Jul 2004 13:15:13 -0000
@@ -260,12 +260,14 @@ gfc_handle_option (size_t scode, const c
       gfc_option.flag_repack_arrays = value;
       break;

-    case OPT_ffixed_line_length_80:
-      gfc_option.fixed_line_length = 80;
+    case OPT_ffixed_line_length_none:
+      gfc_option.fixed_line_length = 0;
       break;

-    case OPT_ffixed_line_length_132:
-      gfc_option.fixed_line_length = 132;
+    case OPT_ffixed_line_length_:
+      if (value != 0 && value < 7)
+       gfc_fatal_error ("Fixed line length must be at least seven.");
+      gfc_option.fixed_line_length = value;
       break;

     case OPT_fmax_identifier_length_:
Index: scanner.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fortran/scanner.c,v
retrieving revision 1.6
diff -u -p -r1.6 scanner.c
--- scanner.c   21 Jun 2004 22:22:32 -0000      1.6
+++ scanner.c   13 Jul 2004 13:15:14 -0000
@@ -671,26 +671,49 @@ gfc_gobble_whitespace (void)
 }


-/* Load a single line into the buffer.  We truncate lines that are too
-   long.  In fixed mode, we expand a tab that occurs within the
-   statement label region to expand to spaces that leave the next
-   character in the source region.  */
+/* Load a single line into pbuf.
+
+   If pbuf points to a NULL pointer, it is allocated.
+   We truncate lines that are too long, unless we're dealing with
+   preprocessor lines or if the option -ffixed-line-length-none is set,
+   in which case we reallocate the buffer to fit the entire line, if
+   need be.
+   In fixed mode, we expand a tab that occurs within the statement
+   label region to expand to spaces that leave the next character in
+   the source region.  */

 static void
-load_line (FILE * input, char *buffer, char *filename, int linenum)
+load_line (FILE * input, char **pbuf, char *filename, int linenum)
 {
   int c, maxlen, i, trunc_flag, preprocessor_flag;
+  static int buflen = 0;
+  char *buffer;
+
+  /* Detemine the maximum allowed line length.  */
+  if (gfc_current_form == FORM_FREE)
+    maxlen = GFC_MAX_LINE;
+  else
+    maxlen = gfc_option.fixed_line_length;

-  maxlen = (gfc_current_form == FORM_FREE)
-    ? 132
-    : gfc_option.fixed_line_length;
+  if (*pbuf == NULL)
+    {
+      /* Allocate the line buffer, storing its length into buflen.  */
+      if (maxlen > 0)
+       buflen = maxlen;
+      else
+       buflen = GFC_MAX_LINE;
+
+      *pbuf = gfc_getmem (buflen + 1);
+    }

   i = 0;
+  buffer = *pbuf;

   preprocessor_flag = 0;
   c = fgetc (input);
   if (c == '#')
-    /* Don't truncate preprocessor lines.  */
+    /* In order to not truncate preprocessor lines, we have to
+       remember that this is one.  */
     preprocessor_flag = 1;
   ungetc (c, input);

@@ -729,8 +752,17 @@ load_line (FILE * input, char *buffer, c
       *buffer++ = c;
       i++;

-      if (i >= maxlen && !preprocessor_flag)
-       {                       /* Truncate the rest of the line.  */
+      if (i >= buflen && (maxlen == 0 || preprocessor_flag))
+       {
+         /* Reallocate line buffer to double size to hold the
+            overlong line.  */
+         buflen = buflen * 2;
+         *pbuf = xrealloc (*pbuf, buflen);
+         buffer = (*pbuf)+i;
+       }
+      else if (i >= buflen)
+       {
+         /* Truncate the rest of the line.  */
          trunc_flag = 1;

          for (;;)
@@ -753,6 +785,14 @@ load_line (FILE * input, char *buffer, c
        }
     }

+  /* Pad lines to the selected line length in fixed form.  */
+  if (gfc_current_form == FORM_FIXED
+      && gfc_option.fixed_line_length > 0
+      && !preprocessor_flag
+      && c != EOF)
+    while (i++ < buflen)
+      *buffer++ = ' ';
+
   *buffer = '\0';
 }

@@ -925,7 +965,7 @@ include_line (char *line)
 static try
 load_file (char *filename, bool initial)
 {
-  char line[GFC_MAX_LINE+1];
+  char *line;
   gfc_linebuf *b;
   gfc_file *f;
   FILE *input;
@@ -963,10 +1003,11 @@ load_file (char *filename, bool initial)
   f->up = current_file;
   current_file = f;
   current_file->line = 1;
+  line = NULL;

   for (;;)
     {
-      load_line (input, line, filename, current_file->line);
+      load_line (input, &line, filename, current_file->line);

       len = strlen (line);
       if (feof (input) && len == 0)
@@ -1003,6 +1044,9 @@ load_file (char *filename, bool initial)
       line_tail = b;
     }

+  /* Release the line buffer allocated in load_line.  */
+  gfc_free (line);
+
   fclose (input);

   current_file = current_file->up;

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

* Re: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
  2004-07-13 20:50             ` Tobias Schlüter
@ 2004-07-19  4:21               ` Paul Brook
  0 siblings, 0 replies; 13+ messages in thread
From: Paul Brook @ 2004-07-19  4:21 UTC (permalink / raw)
  To: fortran; +Cc: Tobias Schlüter, patch

> 2004-07-13  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>
>
> 	PR fortran/16465
> 	* lang.opt (ffixed-line-length-none, ffixed-line-length-): New
> 	options.
> 	(ffixed-line-length-80, ffixed-line-length-132): Remove.
> 	* options.c (gfc_handle_options): Deal with changed options.
> 	* scanner.c (load_line): Change second arg to 'char **',
> 	allocate if pointing to NULL. Keep track of buffer's length.
> 	Adapt buffer size to overlong lines. Pad lines to full length
> 	in fixed form.
> 	(load_file): Adapt to new interface of load_line.

Ok.

We should probably allow arbitrary length lines as an extension in free-form 
mode, but that can be done separately.

Paul

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

* RE: [gofrtran] Fix PR 16465: accept -ffixed-line-length-72
@ 2004-07-13  8:15 Billinghurst, David (CALCRTS)
  0 siblings, 0 replies; 13+ messages in thread
From: Billinghurst, David (CALCRTS) @ 2004-07-13  8:15 UTC (permalink / raw)
  To: Tobias Schlüter, Toon Moene; +Cc: Paul Brook, fortran, patch

Tobias Schlüter wrote: 
> I've updated my patch. But before I post it, I want to know: Is
> support for arbitrary line lengths with --fixed-line-length-none also
> a must, or is the builtin maximum of 132 ok? I just don't want to do
> that work unnecessarily.

Tobi,

I couldn't find a way.  I tried a few fancy ways before I settled on the
very simple tests in g77.dg/ffixed-line-length-*.f.

	David

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

end of thread, other threads:[~2004-07-18 12:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-11 13:19 [gofrtran] Fix PR 16465: accept -ffixed-line-length-72 Tobias Schlüter
2004-07-11 13:34 ` Tobias Schlüter
2004-07-11 14:49 ` Paul Brook
2004-07-11 23:15   ` Tobias Schlüter
2004-07-12 22:49     ` Toon Moene
2004-07-12 23:16       ` Tobias Schlüter
2004-07-12 23:21         ` Steve Kargl
2004-07-13  1:43       ` Tobias Schlüter
2004-07-13  6:41         ` Bud Davis
2004-07-13  8:12           ` Tobias Schlüter
2004-07-13 20:50             ` Tobias Schlüter
2004-07-19  4:21               ` Paul Brook
2004-07-13  8:15 Billinghurst, David (CALCRTS)

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).