Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

g77 segmentation fault possible error allocating large arrays during runtime
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.

Report this thread to moderator Post Follow-up to this message
Old Post
blue mannequin
07-29-04 02:06 AM


Re: g77 segmentation fault possible error allocating large arrays during runtime
Hi George and Jan,

This is "bluemannequin" from my work address.  The above was the first
time I've posted to a news group.  Very pleasantly surprised by the
quickness of the response (i didn't expect any this soon hence the
comparative slowness of my reply).  Many thanks.  To business:

It was a problem with the stacksize.  On the IRIX machine it had already
been set to unlimited (but not on the linux machines).  Running the
following command fixed the problem:

limit stacksize unlimited

I added this also to my .cshrc file.

Thanks again,

Dave

On Tue, 27 Jul 2004 15:03:08 +0200, Jan Vorbrüggen wrote:

> First step in such cases is to check on limits (stacksizes and such) and t
o
> remove them or increase them to the max.
>
> Of course, there is also the possibility that there's a bug in your code a
nd
> that you access an array out of bounds, said access going to an invalid
> address only in the case of larger array bounds.
>
> 	Jan


Report this thread to moderator Post Follow-up to this message
Old Post
David Grant
07-29-04 02:06 AM


Re: g77 segmentation fault possible error allocating large arrays during runtime
Also...

limit stacksize unlimited only worked on the linux machines at work.  For
my home computer I had to use the command ulimit -s unlimited.

Cheers,

Dave

Report this thread to moderator Post Follow-up to this message
Old Post
blue mannequin
07-29-04 08:56 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Fortran archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:30 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.