https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101399

--- Comment #9 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
For completely unrelated reasons I went and looked at gfc_gobble_whitespace and
noticed it already handles the -Wtabs.

A slightly simpler patch:

diff --git a/gcc/fortran/io.cc b/gcc/fortran/io.cc
index 45cac5ee572..55638c6599c 100644
--- a/gcc/fortran/io.cc
+++ b/gcc/fortran/io.cc
@@ -4223,7 +4223,21 @@ match_io (io_kind k)
       if (gfc_current_form == FORM_FREE)
        {
          char c = gfc_peek_ascii_char ();
-         if (c != ' ' && c != '*' && c != '\'' && c != '"')
+
+         /* Issue a warning for an invalid tab in 'print<tab>*'.  After
+            the warning is issued, consume any other whitespace and check
+            that the next char is an *, ', or ".  */
+         if (c == '\t')
+           {
+             gfc_gobble_whitespace ();
+             c = gfc_peek_ascii_char ();
+             if (c != '*' && c != '\'' && c != '"')
+               {
+                 m = MATCH_NO;
+                 goto cleanup;
+               }
+           }
+         else if (c != ' ' && c != '*' && c != '\'' && c != '"')
            {

This test all OK so I will prepare and commit.

Reply via email to