[Bug fortran/33338] New: ERROR MSG FOR "READ (11,FMT='(Q,A)'..." POINTS AT END-OF-LINE RATHER THAN AT Q.

longb at cray dot com gcc-bugzilla@gcc.gnu.org
Fri Sep 7 19:37:00 GMT 2007


The GNU gfortran compiler points at the wrong place for the error in a format
when that format is expressed as a literal argument to the FMT keyword in a
READ statement.  The message is:

  read (11,fmt='(q,a)',end=9) len, rec
                                     1
Warning: Unexpected element in format string at (1)
bug2866.f90:4.12:

The compiler gets the correct spot when the same information is expressed in
a FORMAT statement:

2 format (q,a)
          1
Error: Unexpected element in format string at (1)
bug2866.f90:6.38:

> cat bug2866.f90
  program format_q
  character*80 rec
  open (11,file='qdata',status='old')
1 read (11,2,end=9) len, rec
2 format (q,a)
  read (11,fmt='(q,a)',end=9) len, rec
  print *, len, rec(1:len)
  go to 1
9 close (11)
  end


-- 
           Summary: ERROR MSG FOR "READ (11,FMT='(Q,A)'..." POINTS AT END-
                    OF-LINE RATHER THAN AT Q.
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: longb at cray dot com
 GCC build triplet: x86_64-suse-linux
  GCC host triplet: x86_64-suse-linux
GCC target triplet: x86_64-suse-linux


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



More information about the Gcc-bugs mailing list