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

markeggleston at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |markeggleston at gcc 
dot gnu.org
                 CC|                            |markeggleston at gcc dot 
gnu.org

--- Comment #2 from markeggleston at gcc dot gnu.org ---
Not so simple.

Zero width format descriptors are valid:

f - Fortran 95 and later
g - Fortran 2008 and later
d, e, en, es and ex - Fortran 2018

Note: ex is not yet implemented.

There are also related compile time errors:

    5 | print "(d0.2)", 3.
      |         1
Error: Fortran 2018: positive width required at (1)

and corresponding runtime errors:

Fortran runtime error: Positive width required in format
(d0.2)    
  ^

I currently have:

--------------------------- libgfortran/io/format.c ---------------------------
index 3be861fb19c..0959b3d8f84 100644
@@ -617,6 +617,7 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
   int repeat;
   format_data *fmt = dtp->u.p.fmt;
   bool seen_data_desc = false;
+  int standard;

   head = tail = NULL;

@@ -929,7 +930,14 @@ parse_format_list (st_parameter_dt *dtp, bool *seen_dd)
       /* Processing for zero width formats.  */
       if (u == FMT_ZERO)
        {
-         if (notification_std (GFC_STD_F2008) == NOTIFICATION_ERROR
+          if (t == FMT_F)
+           standard = GFC_STD_F95;
+         else if (t == FMT_G)
+           standard = GFC_STD_F2008;
+         else
+           standard = GFC_STD_F2018;
+
+         if (notification_std (standard) == NOTIFICATION_ERROR
              || dtp->u.p.mode == READING)
            {
              fmt->error = zero_width;

I'm currently working on the test cases, "(d0.2)" indicates there are
additional changes required. I'm now checking e, en and es descriptors.

Reply via email to