This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g77 write bug?
- To: gcc at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org
- Subject: g77 write bug?
- From: "Scott O'Donnell" <odonnell at fsl dot noaa dot gov>
- Date: Wed, 15 Dec 1999 18:49:57 -0700
- Organization: Forecast Systems Lab
I believe I've found an incomplete implementation of the
FORTRAN write routine.
The code is writing (using write()) to an internal character
string that is too small to contain the output using a provided
arbitrary (but correctly constructed) format field. The code
incrementally increases the target string length until it succeeds.
I expect an error to be generated while the string is still
too short to hold the output string and to goto the specified
error label. Instead, no error is generated causing
the subroutine to incorrectly identify the format field width.
I've attached some code that exhibits the behavior that I've
described. I expect the subroutine to return 4, but
instead it returns 1, because it *doesn't* generate an error
when attempting to write 4 characters to a 1 character string.
I'd appreciate the suggestion, if someone can suggest a
better method of determining the length of formatted output.
I've also included the output from g77 --verbose and the
very simple compile and load command.
I & several others are porting a large body of code from
HP-FORTRAN to g77. It is imperative that we get this bug
corrected as soon as possible. I'm hopeful that you will be
able to correct this error soon.
Scott O'Donnell
Forecast Systems Lab
Boulder Co,
(303)497-6562
odonnell@fsl.noaa.gov
--
------------------------------------------------------------------
It's a little-known fact that the Y1K | Scott O'Donnell
problem caused the Dark Ages. | odonnell@fsl.noaa.gov
| 303 497 6562
c... to compile: g77 -o test test.f
c -- beginning of sample code ------------------
program test
integer *4 formatWidth
call determineFormatWidth ("(I4) ", formatWidth)
print *, 'formatWidth = ', formatWidth
stop
end
c determine the size of the output string
subroutine determineFormatWidth (formatStr, formatWidth)
integer *4 formatWidth
Character*(*) formatStr, workStr*10
Do 1710 formatWidth=1,10
Write (workStr(:formatWidth),formatStr,err=1710) 5
Return
1710 Continue
es
formatWidth = 0
return
end
c- end of sample code -------------
// a description of the g77 compiler we are currently using...
g77 --verbose
g77 version 2.95.2 19991024 (release) (from FSF-g77 version 0.5.25 19991024 (release))
Driving: ./bin/g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/specs
gcc version 2.95.2 19991024 (release)
/usr/local/gcc-2.95.2/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/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../i686-pc-linux-gnu/include
/usr/local/gcc-2.95.2/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/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/../../../../include/g++-3
End of omitted list.
/usr/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/f771 -fnull-version -quiet -dumpbase g77-version.f -version -fversion -o /tmp/ccuAbHD8.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/ccU3iVx8.o /tmp/ccuAbHD8.s
GNU assembler version 2.9.1 (i386-redhat-linux), using BFD version 2.9.1.0.23
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/ccmag8ie /tmp/ccU3iVx8.o /usr/lib/crt1.o /usr/lib/crti.o /usr/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtbegin.o -L/usr/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2 -L/usr/local/gcc-2.95.2/lib -lg2c -lm -lgcc -lc -lgcc /usr/local/gcc-2.95.2/lib/gcc-lib/i686-pc-linux-gnu/2.95.2/crtend.o /usr/lib/crtn.o
/tmp/ccmag8ie
__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