g77 list directed io bug?
Tom Beaver
beaver@3-cities.com
Wed Mar 7 22:03:00 GMT 2001
Hi,
I am in the process of porting legacy code to linux. The particular code I
am having trouble with has been sucessfully compiled and run under UNIX
FORTRAN on SUN, SGI, HP workstations and the CRAY XMP mainframe. Indeed,
the code compiles under g77 with no errors. However when I try to execute
the code I get the following error:
[tom@PC1:~]$ ./sp100
invalid number: incomprehensible list input
apparent state: unit 7 named sp100.in
last format: list io
lately reading sequential formatted external IO
Aborted
I am able to trace the source of the error to some list directed read
statements. I have been able to create a simple program and input file
that exhibits the same problem. The two files are included as an
attachment (test.f and test.in). The problem occurs when the program tries
to execute the following line:
READ(7,*) R,S,T,U,V,W
Data in the input file is arranged in columns of 5 so that data for the
first two read statements are all on the same line. However for the read
statement listed above the sixth data value is continued on the following
line (see test.in). This seems to be the problem because if I edit the
input file to include all six
of the parameter values on the same line (ie. make six columns) then the
line reads sucessfully and all six values are initialized properly.
However the code then fails on the next read statement where it is
impracticle to place all values on the same line.
It is my understanding that data prepared for list directed input can be
seperated by a comma (optionally followed by one or more blanks) or one or
more
contiguous blanks and that a carrage return is treated like a blank. In
digging through the only g77 documentation I have it appears that this is
also how g77 should work for list directed io.
The following are the compiler options I used (I have tried others and
different combinations of these as well):
g77 -fno-silent -fno-automatic -fno-f2c -g -Wall -o test test.f
The version of the compiler is as follows:
[tom@PC1:~]$ g77 -v
g77 version 2.96 20000731 (Linux-Mandrake 7.3) (from FSF-g77 version 0.5.26
20000731 (Linux-Mandrake 7.3))
Driving: g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux/2.96/specs
gcc version 2.96 20000731 (Linux-Mandrake 7.3)
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/tradcpp0 -lang-fortran -v
-D__GNUC__=2 -D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix
-Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix)
-Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_pentium__
/dev/null /dev/null
GNU traditional CPP version 2.96 20000731 (Linux-Mandrake 7.3)
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/f771 -fnull-version -quiet
-dumpbase g77-version.f -version -fversion -o /tmp/cc3jYUmE.s /dev/null
GNU F77 version 2.96 20000731 (Linux-Mandrake 7.3) (i586-mandrake-linux)
compiled by GNU C version 2.96 20000731 (Linux-Mandrake 7.3).
GNU Fortran Front End version 0.5.26 20000731 (Linux-Mandrake 7.3)
as -V -Qy -o /tmp/ccAQzSpa.o /tmp/cc3jYUmE.s
GNU assembler version 2.10.90 (i586-mandrake-linux) using BFD version
2.10.0.24
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/ccZoMhwJ
/tmp/ccAQzSpa.o /usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/i586-mandrake-linux/2.96
-L/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../../i586-mandrake-linux/lib
-L/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../.. -lg2c -lm -lgcc -lc
-lgcc
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/crtend.o
/usr/lib/gcc-lib/i586-mandrake-linux/2.96/../../../crtn.o
/tmp/ccZoMhwJ
__G77_LIBF77_VERSION__: 0.5.26 20000731 (prerelease)
@(#)LIBF77 VERSION 19991115
__G77_LIBI77_VERSION__: 0.5.26 20000731 (prerelease)
@(#) LIBI77 VERSION pjw,dmg-mods 19991115
__G77_LIBU77_VERSION__: 0.5.26 20000731 (prerelease)
@(#) LIBU77 VERSION 19980709
I would like to know if g77 will read list directed input through multiple
carrage returns (data contained on several sepearate lines in the input
file). If there is a compiler option that turns this on I would like to
know what it is since I have several other codes to convert which use the
same type of input. If not, then you should be aware of the compilers
behavior.
Thanks in advance.
Tom Beaver
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.f
Type: text/x-fortran
Size: 538 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20010307/52165a34/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.in
Type: text/x-fortran
Size: 592 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20010307/52165a34/attachment-0001.bin>
More information about the Gcc-bugs
mailing list