This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: g77 and array limits
- From: David Ronis <ronis at ronispc dot chem dot mcgill dot ca>
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Cc: ronis at onsager dot chem dot mcgill dot ca, "Dr. Juergen Schnack" <jschnack at uos dot de>, gcc at gcc dot gnu dot org, ronis at ronispc dot chem dot mcgill dot ca
- Date: Tue, 22 Apr 2003 14:37:46 -0400
- Subject: Re: g77 and array limits
- References: <3E92CBB5.6020401@uos.de><16018.53885.323179.591400@ronispc.chem.mcgill.ca><3E92D431.8010009@uos.de><16018.59703.503137.174360@ronispc.chem.mcgill.ca><3E92EAAF.3080907@uos.de><16018.65162.797851.825184@ronispc.chem.mcgill.ca><3EA135E2.1090406@moene.indiv.nluug.nl>
- Reply-to: david dot ronis at mcgill dot ca
Toon Moene writes:
> David Ronis wrote:
>
> > Hi Jurgen
> >
> > Here's a simple test program (that fails)
> >
> > complex*16 foo(10000,10000)
> > integer i,j
> > save foo
> >
> > do i=1,10000
> > do j=1,10000
> > foo(i,j)=i+j
> > end do
> > end do
> > write(*,*)foo(1,1),foo(10000,10000)
> > stop
> > end
> >
> >
> > with g77 3.2.2
> >
> > I get:
> >
> > g77 -static -O0 -Wall test.f
> > test.f: In program `MAIN__':
> > test.f:1:
> > complex*16 foo(10000,10000)
>
> I'm sorry, but I don't get this with 3.2.2 (actually, 3.2.2 prerelease
> 20021207).
>
> Please check with -v what the exact version of the compiler is that you
> are using.
>
You are correct. I must have been using gcc-2.95.3; as you said, with
3.2.2 it compiles. However, it still crashes until you reduce the array
dimension (as described in the latter part of the original post).
With the dimensions as above, the array is equivalent to an array of
400 000 000 reals, and should run if the g77 info page I mentioned is
correct.
Here's an even simpler test:
#define N 10000
real foo(N*N*4)
integer i
save foo
do i=1,N*N*4
foo(i)=i
end do
write(*,*)foo(1),foo(N*N*4)
stop
end
I compile (with 3.2.2)
/usr/bin/g77 -O0 -static -Wall bar.F -static
and when I run:
a.out
Segmentation fault (core dumped)
(it works if I cut the size in half)
David