This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libfortran/56696] New: Formatted (list-directed) input fails to signal end of record


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

             Bug #: 56696
           Summary: Formatted (list-directed)  input fails to signal end
                    of record
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: krefson@googlemail.com


The simple program

program iotest

   character(len=258) :: inp = ' 1.0 1.0 1.0'

   integer :: ios
   real :: a1, a2, a3, a4

   read(inp,*,iostat=ios) a1, a2, a3, a4

   write(*,*) 'IOSTAT=',ios
end program iotest

fails to behave according to the standard, which should generate an
end-of-record condition as the number of items in the input (3) is smaller than
the
number of variables in the I/O list.

[kr@gibbs gfortran-4.8.0]$ gfortran -static-libgfortran iotest.f90
[kr@gibbs gfortran-4.8.0]$ ./a.out
 IOSTAT=           0

The expected behaviour, and the behaviour under 4.7.1 is

$ ./a.out
 IOSTAT=          -1

This is a libgfortran issue:  If compiled with dynamic libgfortran

$ gfortran -o iotest-4.8.0d iotest.f90
$ LD_LIBRARY_PATH=/usr/local/gcc-4.8/lib64 ./iotest-4.8.0d
 IOSTAT=           0
$ LD_LIBRARY_PATH=/usr/local/gcc-4.7.1/lib64 ./iotest-4.8.0d
 IOSTAT=          -1

This output was generated with the gfortran.com linux x86_64 build.

$ gfortran --version
GNU Fortran (GCC) 4.8.0 20130321 (prerelease)
Copyright (C) 2013 Free Software Foundation, Inc.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]