This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
RE: g77 bug report
- From: Gaurav Khanna <gkhanna at liu dot edu>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>, twhall <twhall at cuhk dot edu dot hk>
- Cc: gcc-bugs <gcc-bugs at gcc dot gnu dot org>
- Date: Sun, 17 Nov 2002 10:48:16 -0500
- Subject: RE: g77 bug report
I have g77 3.3 binaries on my website for Apple Darwin. Consider trying that
please ..
gravity.psu.edu/~khanna/hpc.html
Regards
Gaurav
>===== Original Message From Toon Moene <toon@moene.indiv.nluug.nl> =====
>Theodore W. Hall wrote:
>
>> First, THANK YOU for making g77 available on Mac OS X!
>
>Appreciate the thanks !
>
>> SYSTEM
>> ------
>>
>> % uname -a
>> Darwin ted.arch.cuhk.edu.hk 6.1 Darwin Kernel Version 6.1: Fri Sep 6
>> 23:24:34 PDT 2002; root:xnu/xnu-344.2.obj~2/RELEASE_PPC Power Macintosh
>> powerpc
>>
>> % g77 -v
>> Reading specs from /usr/local/lib/gcc-lib/powerpc-apple-darwin5.4/3.1/specs
>> Configured with: ../gcc3/configure --enable-pfe --disable-nls
>> --enable-languages=c,f77
>> Thread model: single
>> Apple Computer, Inc. GCC version 1110, based on gcc version 3.1 20020420
>> (prerelease)
>>
>>
>>
>> BUG
>> ---
>>
>> In a series of SEQUENTIAL UNFORMATTED writes to an external file, each
>> subsequent WRITE over-writes the previous. This is not a problem for
>> FORMATTED writes; only UNFORMATTED.
>>
>>
>>
>> TEST PROGRAM
>> ------------
>>
>> % cat testwrite.f
>> PRINT *, 'Writing sequential unformatted data ...'
>> OPEN (UNIT = 1,
>> & FILE = 'bin.dat',
>> & STATUS = 'UNKNOWN',
>> & ACCESS = 'SEQUENTIAL',
>> & FORM = 'UNFORMATTED',
>> & ERR = 91)
>> WRITE (UNIT = 1, ERR = 92) 1, 2, 3
>> WRITE (UNIT = 1, ERR = 92) 4, 5
>> WRITE (UNIT = 1, ERR = 92) 6
>> CLOSE (UNIT = 1,
>> & STATUS = 'KEEP',
>> & ERR = 93)
>> PRINT *, 'Writing sequential formatted data ...'
>> OPEN (UNIT = 1,
>> & FILE = 'txt.dat',
>> & STATUS = 'UNKNOWN',
>> & ACCESS = 'SEQUENTIAL',
>> & FORM = 'FORMATTED',
>> & ERR = 91)
>> WRITE (UNIT = 1, FMT = 1, ERR = 92) 1, 2, 3
>> WRITE (UNIT = 1, FMT = 1, ERR = 92) 4, 5
>> WRITE (UNIT = 1, FMT = 1, ERR = 92) 6
>> CLOSE (UNIT = 1,
>> & STATUS = 'KEEP',
>> & ERR = 93)
>> 1 FORMAT (3I4)
>> PRINT *, 'Done.'
>> STOP
>> 91 PRINT *, 'OPEN error.'
>> STOP
>> 92 PRINT *, 'WRITE error.'
>> STOP
>> 93 PRINT *, 'CLOSE error.'
>> STOP
>> END
>>
>> % g77 -W -Wall -O -o testwrite testwrite.f
>> %
>>
>> % ./testwrite
>> Writing sequential unformatted data ...
>> Writing sequential formatted data ...
>> Done.
>> %
>>
>> % cat txt.dat
>> 1 2 3
>> 4 5
>> 6
>>
>> % hexdump -C bin.dat
>> 00000000 00 00 00 04 00 00 00 06 00 00 00 04 00 00 00 08
>> |................|
>> 00000010 00 00 00 0c |....|
>> 00000014
>> %
>>
>>
>>
>> EXPECTED RESULT
>> ---------------
>>
>> % hexdump -C bin.dat
>> 00000000 00 00 00 0c 00 00 00 01 00 00 00 02 00 00 00 03
>> |................|
>> 00000010 00 00 00 0c 00 00 00 08 00 00 00 04 00 00 00 05
>> |................|
>> 00000020 00 00 00 08 00 00 00 04 00 00 00 06 00 00 00 04
>> |................|
>> %
>>
>> That is,
>>
>> record length 00 00 00 0c
>> data 00 00 00 01 00 00 00 02 00 00 00 03
>> record length 00 00 00 0c
>>
>> record length 00 00 00 08
>> data 00 00 00 04 00 00 00 05
>> record length 00 00 00 08
>>
>> record length 00 00 00 04
>> data 00 00 00 06
>> record length 00 00 00 04
>>
>> Note that in the actual output, following the last record
>>
>> 00 00 00 04 00 00 00 06 00 00 00 04
>>
>> are the trailing record lengths of the two previous records
>>
>> 00 00 00 08 00 00 00 0c
>
>> which seems to indicate that the earlier longer records were over-written
>> by the later shorter ones.
>
>g77-3.2 seems to produce the correct results on
>powerpc-unknown-linux-gnu. Perhaps there's a problem in the coupling
>between the libf2c.{so|a} - the run time library of g77 - and the
>underlying libc/OS.
>
>It might be helpful to post this problem to a Darwin specific mailing list.
>
>Hope this helps,
>
>--
>Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
>Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
>Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
>Join GNU Fortran 95: http://g95.sourceforge.net/ (under construction)
GAURAV KHANNA
Assistant Professor
Natural Science Division
Long Island University -Southampton
Southampton NY 11968.
PH: 631-287-8411
FAX: 631-287-8419
http://techcenter.southampton.liunet.edu/~gkhanna