g77/gfortran
Tobias Burnus
burnus@net-b.de
Tue Sep 11 11:02:00 GMT 2007
Hi,
Granville Sewell wrote:
> A program that ran when compiled with g77 produces the following result
> when compiled with gfortran and executed:
>
> /root/bin/runpde2d: line 60: 4076 Segmentation fault ./a.out
>
> When compiled using g77 we had to set the stacksize limit
> (limit stacksize 128000) to avoid this error, but that doesn't help
> with gfortran. I realize this probably isn't enough information to
> allow a diagnosis, but thought I'd take a shot. Any compiler options
> you might suggest for gfortran?
>
Well, first of all use -fbounds-check.
Secondly, compile with "-g" and run in a debugger; do a backtrace ("bt"
in gdb) when the program crashes to find out where it crashes.
Thirdly, if you have valgrind, running the binary (compiled with "-g")
through valgrind might also find problems. (This slows down the
execution a lot; if it crashes after hours of calculations, this won't
work well.)
You can tune the usage of the stack using -fmax-stack-var-size=; using
RECURSIVE procedures will increase the needed stack size, however.
Otherwise it is extremely difficult to guess the reason of a crash as
there are millions of possibilities, which cannot narrowed down without
further information.
Tobias
More information about the Fortran
mailing list