public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: g77 and array limits
       [not found]       ` <3E92EAAF.3080907@uos.de>
@ 2003-04-08 18:32         ` David Ronis
  2003-04-19 18:26           ` Toon Moene
  0 siblings, 1 reply; 4+ messages in thread
From: David Ronis @ 2003-04-08 18:32 UTC (permalink / raw)
  To: Dr. Juergen Schnack; +Cc: gcc, ronis

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)
                    ^
Array `foo' at (^) is too large to handle

The info pages have the following:

 * `g77' used to reject the following program on 32-bit targets:
          PROGRAM PROG
          DIMENSION A(140 000 000)
          END
     with the message:
          prog.f: In program `prog':
          prog.f:2:
                   DIMENSION A(140 000 000)
                             ^
          Array `a' at (^) is too large to handle
     because 140 000 000 REALs is larger than the largest bit-extent
     that can be expressed in 32 bits.  However, bit-sizes never play a
     role after offsets have been converted to byte addresses.
     Therefore this check has been removed, and the limit is now 2
     Gbyte of memory (around 530 000 000 REALs).  Note: On GNU/Linux
     systems one has to compile programs that occupy more than 1 Gbyte
     statically, i.e. `g77 -static ...'.

In terms of complex*16, this limit is reduced by 4 and hence the
maximum length of an array is 134 217 728 (or roughly, 11585 for a
square array), which should have worked.  

I've played with the size of the array, and found that it fails for a
square array with a dimension > 5792, corresponding to a maximum
offest that is 1/4 the limit described in the manual.

I'll post this to the gcc list and see what answers I get

David

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: g77 and array limits
  2003-04-08 18:32         ` g77 and array limits David Ronis
@ 2003-04-19 18:26           ` Toon Moene
  2003-04-22 19:39             ` David Ronis
  0 siblings, 1 reply; 4+ messages in thread
From: Toon Moene @ 2003-04-19 18:26 UTC (permalink / raw)
  To: ronis; +Cc: Dr. Juergen Schnack, gcc, ronis

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.

Thanks in advance,

-- 
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
GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: g77 and array limits
  2003-04-19 18:26           ` Toon Moene
@ 2003-04-22 19:39             ` David Ronis
  2003-04-22 23:14               ` Toon Moene
  0 siblings, 1 reply; 4+ messages in thread
From: David Ronis @ 2003-04-22 19:39 UTC (permalink / raw)
  To: Toon Moene; +Cc: ronis, Dr. Juergen Schnack, gcc, ronis

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: g77 and array limits
  2003-04-22 19:39             ` David Ronis
@ 2003-04-22 23:14               ` Toon Moene
  0 siblings, 0 replies; 4+ messages in thread
From: Toon Moene @ 2003-04-22 23:14 UTC (permalink / raw)
  To: david.ronis; +Cc: ronis, Dr. Juergen Schnack, gcc, ronis

David Ronis wrote:

> 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)

What is the total amount of virtual memory on your machine (RAM+SWAP) ?

This code will SEGfault when you have less than 4*4*10**8 = 1.6*10**9 
bytes of addressable memory.

-- 
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
GNU Fortran 95: http://gcc-g95.sourceforge.net/ (under construction)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-22 22:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <3E92CBB5.6020401@uos.de>
     [not found] ` <16018.53885.323179.591400@ronispc.chem.mcgill.ca>
     [not found]   ` <3E92D431.8010009@uos.de>
     [not found]     ` <16018.59703.503137.174360@ronispc.chem.mcgill.ca>
     [not found]       ` <3E92EAAF.3080907@uos.de>
2003-04-08 18:32         ` g77 and array limits David Ronis
2003-04-19 18:26           ` Toon Moene
2003-04-22 19:39             ` David Ronis
2003-04-22 23:14               ` Toon Moene

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).