g77 and array limits

David Ronis ronis@ronispc.chem.mcgill.ca
Tue Apr 8 18:32:00 GMT 2003


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



More information about the Gcc mailing list