From: Steve Lionel <Steve.Lionel@digital.com>
Subject: Re: fortran error?
Date: 1998/03/16 [thread overview]
Message-ID: <6ejfii$kbd@usenet.pa.dec.com> (raw)
In-Reply-To: 3507A4A5.F8A7DDC2@matd.tu-graz.ac.at
In article <3507A4A5.F8A7DDC2@matd.tu-graz.ac.at>, Armin Leuprecht <leu@matd.tu-graz.ac.at> writes:
|>Dynamic allocation using DEC Fortran is working in general.
|>For some strange reason sometimes a programm like the following
|>will crash with a segmentation fault while allocating the memory
|>in line 3 of the subroutine.
|>Though I couldn't reproduce the error with this little program
|>(not even for large values, i.e. more than physical installed
|>memory) I cannot locate another source of failure in my application.
|>
|> SUBROUTINE sub(n)
|> INTEGER n
|> REAL*4 a(n)
|> END
|>
|> PROGRAM test
|> INTEGER n
|> n = 1234
|> CALL sub(n)
|> END
This is not really "dynamic allocation" - a term usually reserved for
variables allocated with ALLOCATE (or malloc). What you have instead
are "automatic arrays", which get allocated on the stack on routine
entry. This requires sufficient stack space. Unfortunately, the default
stacksize limit on DIGITAL UNIX (OSF/1) tends to be on the small side and
it is easy to exceed it with modest programs. Usually, the shell command:
limit stacksize unlimited
(or "ulimit", depending on what your shell is), will take care of this. This
does not actually set the size to be "unlimited", but rather raises it to
the system configuration maximum.
While I'm here, I'll mention that you can see the same problem using
DIGITAL Visual Fortran, since the MS linker allocates the stack at a fixed
size. You can set the stack size in a linker option. It tends NOT to be
a problem on OpenVMS which has done automatic stack expansion since 1980.
--
Steve Lionel mailto:Steve.Lionel@digital.com
Fortran Development http://www.digital.com/info/slionel.html
Digital Equipment Corporation
110 Spit Brook Road, ZKO2-3/N30
Nashua, NH 03062-2698 "Free advice is worth every cent"
For information on DIGITAL Fortran, see http://www.digital.com/fortran
next prev parent reply other threads:[~1998-03-16 5:00 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-03-12 5:00 fortran error? Armin Leuprecht
1998-03-12 5:00 ` robin
1998-03-16 5:00 ` Steve Lionel [this message]
1998-03-17 5:00 ` Peter Shenkin
1998-03-17 5:00 ` Craig Burley
1998-03-17 5:00 ` Peter Shenkin
1998-03-18 5:00 ` Toon Moene
1998-03-18 5:00 ` Jeff Drummond
1998-03-19 5:00 ` Peter Shenkin
1998-03-18 5:00 ` Craig Burley
1998-03-19 5:00 ` Peter Shenkin
1998-03-19 5:00 ` Craig Burley
1998-03-20 5:00 ` Nick Maclaren
1998-03-20 5:00 ` Peter Shenkin
1998-03-20 5:00 ` Craig Burley
1998-03-20 5:00 ` Nick Maclaren
1998-03-20 5:00 ` Richard Maine
1998-03-20 5:00 ` Peter Shenkin
1998-03-23 5:00 ` Craig Burley
1998-03-23 5:00 ` Craig Burley
1998-03-23 5:00 ` Peter Shenkin
1998-03-24 5:00 ` Craig Burley
1998-03-24 5:00 ` Nick Maclaren
1998-03-23 5:00 ` Summary (I hope) failure of automatic allocation; was, " Peter Shenkin
1998-03-24 5:00 ` Craig Burley
1998-03-20 5:00 ` Richard Maine
1998-03-20 5:00 ` Dick Hendrickson
1998-03-20 5:00 ` Craig Burley
1998-03-20 5:00 ` Peter Shenkin
1998-03-23 5:00 ` Craig Burley
1998-03-20 5:00 ` Peter Shenkin
1998-03-18 5:00 ` Steve Lionel
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox