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

            Bug ID: 93733
           Summary: F2008: G0.d output editing for
                    integer/logical/character data
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thenlich at gcc dot gnu.org
  Target Milestone: ---

This example compiles and runs.

But the second part should be rejected with -std=f2008 because these are
Fortran 2018 features.

====
program g0d_ilc
!F2008:
    write(*, "(g0)")  23
    write(*, "(g0)")  .true.
    write(*, "(g0)")  'hello'
!F2018:
    write(*, "(g0.2)")  -23
    write(*, "(g0.2)")  .true.
    write(*, "(g0.2)")  'hello'
end
====

gfortran -std=f2008 g0d_ilc.f90 && ./a.out
23
T
hello
-23
T
hello


The new features of Fortran 2018 (ISO/IEC JTC1/SC22/WG5 N2145):

"The g0.d edit descriptor can be used to specify the output of integer,
logical, and character data. It follows the rules for the i0, l1, and a edit
descriptors, respectively."

F2008:

10.7.5.2.1 Generalized integer editing
When used to specify the input/output of integer data, the Gw.d and Gw.d Ee
edit descriptors follow the rules for the Iw edit descriptor (10.7.2.2), except
that w shall not be zero. When used to specify the output of integer data, the
G0 edit descriptor follows the rules for the I0 edit descriptor.

10.7.5.3 Generalized logical editing
When used to specify the input/output of logical data, the Gw.d and Gw.d Ee
edit descriptors follow the rules for the Lw edit descriptor (10.7.3). When
used to specify the output of logical data, the G0 edit descriptor follows the
rules for the L1 edit descriptor. 

10.7.5.4 Generalized character editing
When used to specify the input/output of character data, the Gw.d and Gw.d Ee
edit descriptors follow the rules for the Aw edit descriptor (10.7.4). When
used to specify the output of character data, the G0 edit descriptor follows
the rules for the A edit descriptor with no field width.

F2018:

13.7.5.2.2 Generalized integer editing
When used to specify the input/output of integer data, the Gw, Gw.d, and Gw.d
Ee edit descriptors follow the rules for the Iw edit descriptor (13.7.2.2).
Note that w cannot be zero for input editing (13.7.5.1). 

13.7.5.3 Generalized logical editing
When used to specify the input/output of logical data, the Gw.d and Gw.d Ee
edit descriptors with nonzero w follow the rules for the Lw edit descriptor
(13.7.3). When used to specify the output of logical data, the G0 and G0.d edit
descriptors follow the rules for the L1 edit descriptor. 

13.7.5.4 Generalized character editing
When used to specify the input/output of character data, the Gw.d and Gw.d Ee
edit descriptors with nonzero w follow the rules for the Aw edit descriptor
(13.7.4). When used to specify the output of character data, the G0 and G0.d
edit descriptors follow the rules for the A edit descriptor with no field
width.

Reply via email to