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)
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?
> 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)
> 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
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.)
> On Jan 10, 3:10 pm, "tia...@gmail.com" <tia...@gmail.com> wrote:
> > 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)
> > 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
> 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
Yeah, it is about the stack size. After set it to infinite (in CSH: unlimit stacksize), the program runs successfully now. :)