This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran,patch] Ignore byte order mark at start of file
On Wed, Apr 25, 2007 at 11:23:57PM +0200, Tobias Schlüter wrote:
> Brooks Moses wrote:
> > This part assumes that line[1] and line[2] exist. However, line[] is
> > allocated in load_line as having length maxlen, which is set to
> > gfc_option.free_line_length if we have free-form source with limited
> > line lengths, and there is no guarantee that free_line_length is 3 or
> > higher.
> >
> > Thus, these should be conditioned on line_len > 2 or 3 as appropriate.
>
> Exactly this point came up in FX and my discussion on IRC :-)
> -ffree-line-length < 3 makes no sense because the END statement may not
> be continued, and every program unit will have one of them. I wanted to
> craft a patch ensuring that restriction tomorrow. Please be my guest if
> you want to submit the obvious patch to options.c yourself.
That sounds reasonable, yes. I think that it would still be good to put
a gcc_assert (line_len >2) before the BOM-checks, though, just to
document this assumption and cause an error in case it gets violated.
- Brooks