This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Large file suppport in g77?
- To: Giacomo Mulas <gmulas at ca dot astro dot it>
- Subject: Re: Large file suppport in g77?
- From: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Date: Mon, 31 Jul 2000 20:56:41 +0200
- CC: gcc at gcc dot gnu dot org
- Organization: Moene Computational Physics, Maartensdijk, The Netherlands
- References: <Pine.LNX.4.21.0007311547040.894-100000@capitanata.ca.astro.it>
Giacomo Mulas wrote:
> Hello, I have to handle files larger than 2Gbytes on an x86
> computer running Linux. The current test kernels (v2.4.0-test) do support
> the Large File Summit (LFS) on x86, as does the current 2.1.3 version of
> glibc. To enable LFS support one has to compile the library on a computer
> running such a kernel, and afterwards define some macro symbols in the C
> program to be compiled (as documented in glibc docs). I have tested this
> and it works well, apparently.
> However, it seems to only work with C programs, and I also have to
> compile some Fortran code. How can I get g77 to use the LFS
> extensions? Would somebody even just point me to some document, HOWTO, FAQ
> or web page in which this is explained?
A week ago I sent the following to gcc-bugs@gcc.gnu.org, which explains
it in enough detail, I think:
<QUOTE>
Yosuke Toh wrote:
> Do the g77(v0.5.24) support for reading from a over 2Gbyte file?
> (My program is run on FreeBSD(3.3).)
> This program can read under 2Gbyte.
> But over 2Gbyte, can't do it.
>
> open and read
>
> open(15,file=open_file,access='direct',recl=bufferdatasize*2,err=
> 9029,status='old',iostat=iosopen)
> read(15,rec=renum,err= 9029,iostat=iosread)(data(i),i=1,bufferdatasize)
>
> When 'rec=renum' is extend to 2Gbyte, 'iostat=iosread' return to -1.
Hmmm, when I tried to write over 2 Gbyte, using this program:
PARAMETER (NRECLN=250 000, NRECS=2 500)
REAL A(NRECLN)
DO I = 1, NRECLN
A(I) = I
ENDDO
OPEN(UNIT=1,ACCESS='DIRECT',RECL=4*NRECLN,STATUS='UNKNOWN')
DO I = 1, NRECS
WRITE(UNIT=1,REC=I,IOSTAT=IOS) A
IF (IOS .NE. 0) THEN
PRINT*,'WRITE FAILED, REC=',I,' IOSTAT=',IOS
GOTO 10
ENDIF
ENDDO
10 CONTINUE
CLOSE(UNIT=1)
END
on i686-pc-linux-gnu, it also failed to write more than 2 Gbyte:
$ ls -l /tmp/aap
-rw-rw-r-- 1 toon toon 2147483647 Jul 26 15:25 /tmp/aap
Unfortunately, it didn't give an error indication (it just completed
"normally" :-(). This was using the g77-0.5.25 that's in gcc-2.95.2.
On alphaev6-unknown-linux-gnu (a machine with 64-bit sizes and offsets)
the above program with NRECS=5 000 was able to create the correctly
sized file:
ls -l /tmp/aap
-rw-rw-r-- 1 toon toon 5000000000 Jul 26 16:10 /tmp/aap
So most probably the limitation is inside the libf2c run time library,
that uses `long' variables for I/O sizes and offsets - which is 32 bits
on an Intel PC and 64 bits on Alpha.
</QUOTE>
> "When the storms are raging around you, stay right where you are"
> (Freddy Mercury)
You can leave _that_ to us, meteorologists ...
--
Toon Moene - mailto:toon@moene.indiv.nluug.nl - phoneto: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands
GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
GNU Fortran 95: http://g95.sourceforge.net/ (under construction)