This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with g77 or bug?


Hi,

I have a problem when running very large Fortran77 programs under linux.
With the following test program the error is reproducible:

        program testmem
        implicit none
        character*(20)  dummy
        integer i
        integer maxsize
        parameter (maxsize = 10000000)

        integer array01(2*maxsize)
        integer array02(2*maxsize)
        integer array03(2*maxsize)
        integer array04(2*maxsize)
        integer array05(2*maxsize)
        integer array06(2*maxsize)
        integer array07(2*maxsize)
C       integer array08(2*maxsize)

        do 1 i = 1,2*maxsize
           array01(i) = 0
           array02(i) = 0
           array03(i) = 0
           array04(i) = 0
           array05(i) = 0
           array06(i) = 0
           array07(i) = 0
C          array08(i) = 0
 1      continue

        print *,'Press a key and "ENTER" afterwards to continue'
        read *,dummy
        print *,'Done'

        end

Compiling this using g77, I get:

pc109:[haefele]> g77 -v
g77 version 2.95.2 19991024 (release) (from FSF-g77 version 0.5.25
19991024 (release))
.....
pc109:[haefele]> g77 -o testmem test.f
pc109:[haefele]> size testmem 
   text    data     bss     dec     hex filename
  34802     812 560010744       560046358       2161a116        testmem
pc109:[haefele]> ./testmem 
 Press a key and "ENTER" afterwards to continue
q
 Done

So this works nicely. Now uncommenting the two lines with comments in
the program and performing the same steps again, I get:

pc109:[haefele]> size testmem 
   text    data     bss     dec     hex filename
  34818     812 640010744       640046374       26265526        testmem
pc109:[haefele]> ./testmem 
Segmentation fault


I couldn't figure out where this seg fault comes from. My machine is a
linux box with 1.5G Ram, the kernel is compiled with CONFIG_2GB=y so
there should be no problem from there. Moreover a test program in C can
use the whole Ram. What can I do?

Thanks for your help, (sorry for this lengthy description)

best regards,

Martin Haefele.
-- 
################################################################
  Martin Haefele
  Max Planck Institute for Dynamics of Complex Technical Systems
  Leipziger Str. 44
  39 120 MAGDEBURG
  Phone: +49 391 6117 521                  Fax: +49 391 6117 545
  e-Mail: mailto:haefele@mpi-magdeburg.mpg.de
################################################################


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]