[Bug libfortran/48682] New: Incorrect field justification with Gw.d edit descriptor

jb at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 19 09:23:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48682

           Summary: Incorrect field justification with Gw.d edit
                    descriptor
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: jb@gcc.gnu.org


Consider:

program gformat
  real(8) :: r
  integer :: ii
  do ii = -8, 25
     r = 10._8**ii / 3.0_8
     print '(A,G13.6,A,G0.6,A,G0,A)', ":::", r, ":::", r, ":::", r, ":::"
  end do
end program gformat

This program prints:

::: 0.333333E-08:::.333333E-008:::.33333333333333334E-008:::
::: 0.333333E-07:::.333333E-007:::.33333333333333334E-007:::
::: 0.333333E-06:::.333333E-006:::.33333333333333330E-006:::
::: 0.333333E-05:::.333333E-005:::.33333333333333337E-005:::
::: 0.333333E-04:::.333333E-004:::.33333333333333335E-004:::
::: 0.333333E-03:::.333333E-003:::.33333333333333332E-003:::
::: 0.333333E-02:::.333333E-002:::.33333333333333335E-002:::
::: 0.333333E-01:::.333333E-001:::.33333333333333333E-001:::
::: 0.333333    :::.333333:::.33333333333333331:::
:::  3.33333    :::3.33333:::3.3333333333333335:::
:::  33.3333    :::33.3333:::33.333333333333336:::
:::  333.333    :::333.333:::333.33333333333331:::
:::  3333.33    :::3333.33:::3333.3333333333335:::
:::  33333.3    :::33333.3:::33333.333333333336:::
:::  333333.    :::333333.:::333333.33333333331:::
::: 0.333333E+07:::.333333E+007:::3333333.3333333335:::
::: 0.333333E+08:::.333333E+008:::33333333.333333332:::
::: 0.333333E+09:::.333333E+009:::333333333.33333331:::
::: 0.333333E+10:::.333333E+010:::3333333333.3333335:::
::: 0.333333E+11:::.333333E+011:::33333333333.333332:::
::: 0.333333E+12:::.333333E+012:::333333333333.33331:::
::: 0.333333E+13:::.333333E+013:::3333333333333.3335:::
::: 0.333333E+14:::.333333E+014:::33333333333333.332:::
::: 0.333333E+15:::.333333E+015:::333333333333333.31:::
::: 0.333333E+16:::.333333E+016:::3333333333333333.5:::
::: 0.333333E+17:::.333333E+017:::33333333333333332.:::
::: 0.333333E+18:::.333333E+018:::.33333333333333331E+018:::
::: 0.333333E+19:::.333333E+019:::.33333333333333335E+019:::
::: 0.333333E+20:::.333333E+020:::.33333333333333332E+020:::
::: 0.333333E+21:::.333333E+021:::.33333333333333331E+021:::
::: 0.333333E+22:::.333333E+022:::.33333333333333335E+022:::
::: 0.333333E+23:::.333333E+023:::.33333333333333332E+023:::
::: 0.333333E+24:::.333333E+024:::.33333333333333333E+024:::
::: 0.333333E+25:::.333333E+025:::.33333333333333338E+025:::



However F2008 (N1830.pdf) 10.7.2.1 says

"
On output, the representation is right justified in the field. If the number of
characters produced by
the editing is smaller than the field width, leading blanks are inserted in the
field.
"

That is, when Gw.d uses F format, the field is not right justified. For
comparison the second and third columns using the G0.d and G0 edit descriptors
are correctly right justified (and the field width is the minimum one, as also
required for the G0 and G0.d descriptors).



More information about the Gcc-bugs mailing list