This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
end and err labels not used in g77 during internal files read
- To: gcc-bugs at gcc dot gnu dot org
- Subject: end and err labels not used in g77 during internal files read
- From: Luc Maisonobe <Luc dot Maisonobe at cnes dot fr>
- Date: Fri, 02 Mar 2001 11:44:33 +0100
- Cc: Géraldine FILAIRE <Geraldine dot Filaire at cnes dot fr>, jft at kaula dot cst dot cnes dot fr
- Organization: CNES
Hello,
We have encountered a strange behaviour of g77 while reading internale
files (character arrays). The END= and ERR= specifiers seem to be
ignored. The following program shows this behaviour. We intend the first
read to succeed and the second one to fail because the last expected
field is missing. However when I run this on either a linux or a Solaris
host, I get this output :
date 2001 03 01 10 44 03 999 has been successfully read
date 2001 03 01 10 44 03 has been successfully read
One should note that several other compilers have the same strange
behaviour. The problem was discovered by a program failing here when
compiled with SUN forte 6.1 compiler on solaris. I once suspected that
such specifiers were not available on internal files and checked the
ISO/IEC 1539 norm which states that the end-of-file condition is
triggered "when an attempt is made to read a record beyond the end of an
internal file".
The program is :
program gulps
character*30 date
integer year, month, day, hour, min, sec, milli
c
date = '2001 03 01 10 44 03 999'
read (date, 10, err=20, end=30) year, month, day,
> hour, min, sec, milli
write (6, *) 'date ', date, ' has been successfully read'
c
date = '2001 03 01 10 44 03'
read (date, 10, err=20, end=30) year, month, day,
> hour, min, sec, milli
write (6, *) 'date ', date, ' has been successfully read'
c
stop
c
10 format (i4, 1x, i2, 1x, i2, 1x, i2, 1x, i2, 1x, i2, 1x, i3)
20 continue
write (6, *) 'read error on date ', date
stop
30 continue
write (6, *) 'premature end of date ', date
stop
end
The g77 version I use is the one shipped with gcc 2.95.2 :
g77 version 2.95.2 19991024 (release) (from FSF-g77 version 0.5.25
19991024 (release))
Driving: g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/cpp -lang-c -v -D__GNUC__=2
-D__GNUC_MINOR__=95 -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix
-D__linux -Asystem(posix) -D_LANGUAGE_FORTRAN -traditional -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686
-D__i686__ -D__pentiumpro -D__pentiumpro__ /dev/null /dev/null
GNU CPP version 2.95.2 19991024 (release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search
path:
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
End of omitted list.
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/f771 -fnull-version -quiet
-dumpbase g77-version.f -version -fversion -o /tmp/ccQNHFFm.s /dev/null
GNU F77 version 2.95.2 19991024 (release) (i686-pc-linux-gnu) compiled
by GNU C version 2.95.2 19991024 (release).
GNU Fortran Front End version 0.5.25 19991024 (release)
as -V -Qy -o /tmp/ccugIm0E.o /tmp/ccQNHFFm.s
GNU assembler version 2.9.5 (i386-redhat-linux) using BFD version
2.9.5.0.22
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/cc8i1DZ0
/tmp/ccugIm0E.o /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtbegin.o
-L/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2 -lg2c -lm -lgcc -lc -lgcc
/usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtend.o /usr/lib/crtn.o
/tmp/cc8i1DZ0
__G77_LIBF77_VERSION__: 0.5.25 19991024 (release)
@(#)LIBF77 VERSION 19990503
__G77_LIBI77_VERSION__: 0.5.25 19991024 (release)
@(#) LIBI77 VERSION pjw,dmg-mods 19990503
__G77_LIBU77_VERSION__: 0.5.25 19991024 (release)
@(#) LIBU77 VERSION 19980709
thanks,
Luc
--
-----------------------------------------------------------------------
Luc Maisonobe - DTS/MPI/MS/AM | Tel : (33) 05-61-28-26-31
CNES | Fax : (33) 05-61-27-35-40
18 avenue E. Belin |
31401 Toulouse CEDEX 4 - FRANCE | Email: Luc.Maisonobe@cnes.fr
-----------------------------------------------------------------------