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]

Re: [gfortran,patch] Ignore byte order mark at start of file


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.


Index: gcc/testsuite/gfortran.dg/bom_UTF16-LE.f90
===================================================================
--- gcc/testsuite/gfortran.dg/bom_UTF16-LE.f90    (revision 0)
+++ gcc/testsuite/gfortran.dg/bom_UTF16-LE.f90    (revision 0)
@@ -0,0 +1,7 @@
+ÿþp·r·i·n·t· ·*·,· ·"·H·e·l·l·o· ·w·o·r·l·d·"·
+·
+·e·n·d·
+·
+·!· ·{· ·d·g·-·d·o· ·c·o·m·p·i·l·e· ·}·
+·
+·

Does the testsuite harness know what to do with a "dg-do compile" that's in UTF-16 format?

An interesting question, that I didn't think of.


Cheers,
- Tobi


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