g77 segmentation fault possible error allocating large arrays during runtime

From: blue mannequin (bluemannequin_at_ntlworld.com)
Date: 07/27/04


Date: Tue, 27 Jul 2004 13:13:38 GMT

Hello,

Generally I have been using g77 when writing and debugging my programs,
but a different compiler (f77 on an IRIX machine) when running them.
My program compiles and runs fine using f77 on the IRIX. It also compiles
fine using g77 but crashes when running with a segmentation fault. After
some debugging it appears that the segmentation fault occurs after g77 has
allocated about 10MB of memory for use in arrays during runtime. If I
change the size of the arrays used (my program integrates over a 2D grid)
and so it is easy to reduce the number of points on the grid) the program
will run fine using g77. Also if I add arrays e.g. for temporary storage
of intermediate results the program will crash with a segmentation fault
at the start of the subroutine that allocates these new arrays (presuming
they are large enough).

Can anyone explain this since I prefer to use linux and g77 for
debugging(with ddd using gdb) and also i work quite a lot from home (linux).

I am guessing at this point that the program compiled with g77 can't
handle large arrays properly. (I have over 256MB RAM on any machine I use
g77 with at work or at home.)

Thanks in advance.

Dave

p.s. i use only the option -g. Also I have just attempted compilation
without the -g flag and adding the optimisation switch -O2 with the same
result.



Relevant Pages

  • Re: fortran unix code in linux
    ... > I am trying to run a fortran code with g77 in a debian linux. ... > It compiles but when running it, ... I had to compile some older Fortran code with g77 under linux. ...
    (comp.lang.fortran)
  • Re: call by value/reference conundrum (C<->Fortran)
    ... > I use a data analysis and visualisation application written in C (IDL ... > being done here is that the call to bar is passing the _pointers_ to ... > g77 issues warnings about passing by value at one point (in the call to ... > but still compiles and links succesfully. ...
    (comp.lang.fortran)
  • Re: g77 and DVF works fine but ifc causes a run-time error! Any ideas?
    ... > which compiles and runs just fine with g77 under Linux and DVF under ... > dimension lnods,nodad ... nodad as an assumed-size array. ... Note that g77 doesn't do bounds-checking. ...
    (comp.lang.fortran)
  • Re: Windows array allocation problem
    ... would find real benefit in using such large arrays on 32-bit XP. ... don't think g77 was made available for 64-bit Windows; ... I mentioned g77 just as an example of the general principle that some ...
    (comp.lang.fortran)