Question with binary IO with g77 on windows and Bug with fputc
toon@moene.indiv.nluug.nl
toon@moene.indiv.nluug.nl
Mon Jan 17 13:38:00 GMT 2000
Martin Kahlert wrote:
> I have a problem with g77 on WinNT (mingw) regarding binary output.
> OPEN(77,FILE='TEST',ACCESS='SEQUENTIAL',FORM='FORMATTED')
> WRITE(77,'(A1,$)') CHAR(10)
> CLOSE(77)
> END
Note that this is *not* binary output (which is not really defined in
Fortran - what you want is probably just "I/O without frills").
FORMATTED I/O results in text files, and apparently on a Windows NT
machine this means that linefeeds are transformed into carriage retun
line feed pairs (so that you can read the resulting text file in, e.g.
NotePad).
The following program (although somewhat contrived) probably does what
you want:
OPEN(77,FILE='TEST',ACCESS='DIRECT',FORM='UNFORMATTED',RECL=1)
WRITE(77,REC=1) CHAR(10)
CLOSE(77)
END
The following is an outright bug (I don't know why this hasn't been
caught earlier):
> OPEN(77,FILE='TEST',ACCESS='SEQUENTIAL',FORM='FORMATTED')
> CALL FPUTC(77,CHAR(10))
> CLOSE(77)
> END
it also crashes over here:
% g77 -v kahlert2.f
g77 version 2.95.3 19991030 (prerelease) (from FSF-g77 version 0.5.25 19991030 (prerelease))
Driving: g77 -v kahlert2.f -lg2c -lm
Reading specs from /usr/local/lib/gcc-lib/m68k-next-nextstep3/2.95.3/specs
gcc version 2.95.3 19991030 (prerelease)
/usr/local/lib/gcc-lib/m68k-next-nextstep3/2.95.3/f771 kahlert2.f -quiet -dumpbase kahlert2.f -version -fversion -o /usr/tmp/ccsXJ76l.s
GNU F77 version 2.95.3 19991030 (prerelease) (m68k-next-nextstep3) compiled by GNU C version 2.95.3 19991030 (prerelease).
GNU Fortran Front End version 0.5.25 19991030 (prerelease)
./../../egcs/gcc/f/com.c:11439: failed assertion `expr != NULL'
g77: Internal compiler error: program f771 got fatal signal 6
I'll see if I can track this down ...
Thanks for your bug report,
Toon.
More information about the Gcc-bugs
mailing list