For Programmers: Free Programming Magazines  


Home > Archive > Fortran > July 2004 > Re: g77 segmentation fault possible error allocating large arrays









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: g77 segmentation fault possible error allocating large arrays
George N. White III

2004-07-28, 9:06 pm

On Tue, 27 Jul 2004, blue mannequin wrote:

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


This sort of problem usually indicates a bug in your code -- have you used
ftncheck and the runtime array bounds checking? f77 on Irix is very old
-- are you runing Irix 5.3? I use g77 on linux but f90 on Irix, which
allows me to use the f90 capabilities that have been implemented in g77.

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


10MB is _NOT_ a large array by current standards. Unless you are using
g77 and linux of the same vintage as your f77 compiler the chances that
this is a g77 bug are very small.

--
George N. White III <aa056@chebucto.ns.ca>
Head of St. Margarets Bay, Nova Scotia, Canada
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com