Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Strange "Segmentation fault (core dumped)" error.

16 views
Skip to first unread message

tia...@gmail.com

unread,
Jan 10, 2009, 9:10:32 AM1/10/09
to
I had been bothered with a "Segmentation fault (core dumped)" error in
the past few days. When insert more array definition in the
subroutine, the program will exit with an error.

The main program (test.f) is
program test
character*1023 file
character*20 dtype
integer nlat,nlon,ntim
real d(600,1440,12)

file='anything.txt'
dtype='test'

nlat=600
nlon=1440
ntim=12
call rdnc(file,dtype,d,nlat,nlon,ntim)

end

The subroutine (rdnc.f) is
subroutine rdnc(file,dtype,d,nlat,nlon,ntim)
character*(*) file,dtype
integer nlat,nlon,ntim
real d(nlat,nlon,ntim)
c real d2(nlat,nlon,ntim)

write(*,*) file
c ...

end

When uncomment the d2 array definition line, the program reports an
error:
[tianyf@tyf error.parameters]$ ifort rdnc.f test.f -o test && ./test
Segmentation fault (core dumped)

I use Intel Fortran Compiler for Linux version 10.1 and run in redhat
linux 9.0.
[tianyf@tyf error.parameters]$ uname -a
Linux tyf 2.4.20-8 #1 Thu Mar 13 17:54:28 EST 2003 i686 i686 i386 GNU/
Linux
[tianyf@tyf error.parameters]$

I has 2GB RAM and 512 MB swap space, thus I think this error is not
related to memory capacity. Could someone get me out of the problem?


Cheers,
Tian


michael...@compuserve.com

unread,
Jan 10, 2009, 9:48:10 AM1/10/09
to

You need to increase your default stack size, I'm sure. (You have the
space, but the compiler does not necessarily allow access to all of
without your telling it.)

Regards,

Mike Metcalf

tia...@gmail.com

unread,
Jan 10, 2009, 10:35:43 AM1/10/09
to

Yeah, it is about the stack size. After set it to infinite (in CSH:
unlimit stacksize), the program runs successfully now.
:)

Cheers,
Tian

0 new messages