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

--- Comment #4 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> ---
Proposed patch:

diff --git a/libgfortran/io/format.c b/libgfortran/io/format.c
index f5d3158d21d..5ad57bef316 100644
--- a/libgfortran/io/format.c
+++ b/libgfortran/io/format.c
@@ -46,7 +46,8 @@ static const char posint_required[] = "Positive width
required in format",
   bad_string[] = "Unterminated character constant in format",
   bad_hollerith[] = "Hollerith constant extends past the end of the format",
   reversion_error[] = "Exhausted data descriptors in format",
-  zero_width[] = "Zero width in format descriptor";
+  zero_width[] = "Zero width in format descriptor",
+  comma_missing[] = "Missing comma between descriptors";

 /* The following routines support caching format data from parsed format
strings
    into a hash table.  This avoids repeatedly parsing duplicate format strings
@@ -1168,8 +1169,10 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
       goto finished;

     default:
-      /* Assume a missing comma, this is a GNU extension */
-      goto format_item_1;
+      /* Assume a missing comma with -std=legacy, GNU extension. */
+      if (compile_options.warn_std == 0)
+       goto format_item_1;
+      format_error (dtp, tail, comma_missing);
     }

   /* Optional comma is a weird between state where we've just finished

This then gives:

$ gfc pr88052.f90 
$ ./a.out 
 (AF9.6)                                 
At line 6 of file pr88052.f90 (unit = 6, file = 'stdout')
Fortran runtime error: Missing comma between descriptors
(AF9.6)                                 
  ^

Reply via email to