real      val
      character str*6
      open(1,FILE="tmp.dat")
      read(1,'(a6,f4)') str,val
      print*,str,val
      end

gfortran tells me as follows:
      read(1,'(a6,f4)') str,val
                                                                       1
Warning: Period required in format string at (1)

# ./a.out
At line 4 of file read_gfc_test.f
Fortran runtime error: Period required in format
(a6,f4)
      ^

At compile time, gfortran issues only a warning, although it aborts
unconditionally at runtime, which comes as a bad surprise.
Either gfortran should abort at compile time, or it should support
this syntax ("f4" as an equivalent of "f4.0").
Same issue also for writing.

Support would be probably easy (not regtested, but works for me):
At Line 726 of libgfortran/io/format.c:
      if (t != FMT_PERIOD)
        {
          /* We treat missing decimal descriptor as 0 !! */
          fmt->saved_token = t;
          tail->u.real.d = 0;
          break;
        }

This is a regression vs. g77.


-- 
           Summary: formatted reading/writing: real format without dot
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manfred99 at gmx dot ch


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

Reply via email to