On 11/4/26 02:16, Mikael Morin wrote:
Le 04/11/2026 à 07:44, Steve Kargl a écrit :
I'll let you and Harald decide how to proceed as I have not
been too active in gfortran development lately.  However, I
think 6.1.6 is clear.  A utf-8 BOM shall not appear as the first
character in a line.

This case is borderline, as the BOM doesn't really represent a character of the input source.  It's more encoding metadata.  For the same reason, I think it should removed from the buffer returned by load_line. It's good that we gracefully accept it, but maybe a warning could be emitted, as we don't check that the characters seen in the source are consistent with the BOM (that is they are a valid UTF-8 code sequence if a BOM was seen).

It is an invalid character in the input stream of Fortran tokens.
We have -Wtabs to deal with tabs that are used instead of spaces
(and I still think an error should be the default).

Compile this, run the executable, and then compile foo.f90.

program foo
   implicit none
   character, parameter :: vt = char(11), nl = char(10), ht = char(9)
   character(len=512) buf
   integer fd
   open(newunit=fd, file='foo.f90', status='replace', access='stream')
   buf = ht // vt // 'program foo' // nl
   buf = trim(buf) // "print *, 'hello'" // nl
   buf = trim(buf) // 'end program ' // vt//ht // 'foo' // nl
   write(fd) trim(buf)
   close(fd)
end program foo

If you use 'gfortran -o z -Wtabs foo.f90' only the first occurrence
of a horizontal tab is caught.  All occurrences of a vertical tab
are flagged as errors.  It would seem to me that a BOM is in the
same class as a vertical tab.

--
steve

Reply via email to