Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
From: Peter Shenkin <shenkin@still3.chem.columbia.edu>
Subject: Re: fortran error?
Date: 1998/03/17	[thread overview]
Message-ID: <350E95A7.41C6@still3.chem.columbia.edu> (raw)
In-Reply-To: 6ejfii$kbd@usenet.pa.dec.com


Steve Lionel wrote:
> 
> In article <3507A4A5.F8A7DDC2@matd.tu-graz.ac.at>, Armin Leuprecht <leu@matd.tu-graz.ac.at> writes:
...
> |>For some strange reason sometimes a programm like the following
> |>will crash with a segmentation fault...
> |>      SUBROUTINE sub(n)
> |>      INTEGER n
> |>      REAL*4  a(n)
> |>      END
...

> ...  What you have 
> 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.
...

I would really like to see an addition to the standard which requires
inability to "allocate" an automatic to be treated similarly to
the treatment of inability to ALLOCATE an ALLOCATABLE when no STATUS
variable is supplied:  namely, stop the program with a descriptive
error message.  I believe the Absoft compilers do this (at least
the LINUX one.)

Quality of implementation should demand even more than this:  if
an automatic cannot be "allocated" on the stack, the run-time system
should allocate it on the heap.  Even a compile-time option that
allows a size threshold to be specified for heap, rather than stack,
allocation of automatics would be a step in the right direction.
Cray gives us this feature for the Cray (not the SGI) platform.

Thus, there would seem to be precedent for several solutions that
are better than the one supplied by DEC and most other F90 systems.
DEC is no worse than average here;  I have the same problem with SGI.
But all these implementations are sadly lacking in this regard, IMHO.

To add to the problem, the SEGV that is generated by this sort of
error is generally untrappable, since signals are handled on the
stack (at least in UNIX).  Once the stack has been blown, a signal
handler can't trap the SEGV.  The net effect is that if your customer
is running with a small stack size -- and he may even be unaware he
is doing so, as Armin was -- he gets a SEGV and a core dump, and
thinks your program has a bug.  Feh.

	-P.

-- 
************** In memoriam, Grandpa Jones, 1913-1998, R.I.P.
**************
* Peter S. Shenkin; Chemistry, Columbia U.; 3000 Broadway, Mail Code
3153 *
** NY, NY  10027;  shenkin@columbia.edu;  (212)854-5143;  FAX: 678-9039
***
*MacroModel WWW page:
http://www.columbia.edu/cu/chemistry/mmod/mmod.html *



  reply	other threads:[~1998-03-17  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
1998-03-17  5:00   ` Peter Shenkin [this message]
1998-03-17  5:00     ` Craig Burley
1998-03-17  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                   ` 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                   ` Nick Maclaren
1998-03-20  5:00                     ` Richard Maine
1998-03-20  5:00                 ` Richard Maine
1998-03-20  5:00             ` Dick Hendrickson
1998-03-20  5:00               ` Peter Shenkin
1998-03-20  5:00               ` Craig Burley
1998-03-20  5:00                 ` Peter Shenkin
1998-03-23  5:00                   ` Craig Burley
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     ` 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