Ar an 13u la de mi 9, scriobh Michael Treacy :
>
> Ok, here's the question: in general, what causes segmentation faults?
>
The address space of a program is divided into segments; only some of
those segments, notably the stack (where local variables are stored)
and the heap (where malloc'ed ones (in C) are), are writable. Try to
write anywhere else (e.g. to a constant string, to the address 0, to
the address -1) and you have a segmentation fault. So, it means you're
writing where you're not supposed to.
> I've gone through the second fortran program, even added in print commands
> to see how far down the program, I was getting, but the first one isn't even
> reached.
Does it reach it when you're not trying to read this input file? Have
you tried reading from another input file? I'd advise trying GDB,
except it doesn't seem to like fortran, unfortunately;
(gdb.info)
GDB can be used to debug programs written in Fortran, although it
does not yet support entering expressions, printing values, or similar
features using Fortran syntax. It may be necessary to refer to some
variables with a trailing underscore.
Chris Higgins' strace suggestion is probably the way to go. If you're
not on Linux, investigate ktrace (some BSD) and truss (SVR4).
--
`... when the elephant man broke strong men's necks, when he'd had too
many Powers, ...'
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!