From: Peter Shenkin <shenkin@still3.chem.columbia.edu>
Subject: Re: fortran error?
Date: 1998/03/20 [thread overview]
Message-ID: <351296BC.167E@still3.chem.columbia.edu> (raw)
In-Reply-To: y6n2emoxa6.fsf@tweedledumb.cygnus.com
Craig Burley wrote:
...
> Essentially, using FORTRAN 77, it is fairly straightforward to
> analyze a complete program and determine whether it will run
> to completion in a given amount of memory, because there's
> no ability to explicitly *or* implicitly demand dynamic
> allocation of memory resources (stack or heap).
I think this isn't completely true, but it certainly became a lot
less true, as you point out, with the advent of the new features
of F90.
Even in F77, it would have been difficult to determine the maximum
depth of subroutine calls that would be possible for a given program.
It would have been possible to compute an upper bound, since, in
the absence of recursion, an analyzer could assume that every procedure
was chained together in one single call chain, and compute the stack
requirements of this chain. But this would almost always be a severe
overestimate of what the real program does.
But the even simpler analysis of determining the stack resources
required for each subroutine, and refusing to start if the stack was
too small, was never, as far as I know, done. For instance, if
some subroutine declared a local as "REAL A(100000000)", and if
locals are allocated on the stack, and if there is not enough stack
space for 10^8 reals, it should be possible, in principle for the
run-time system to refuse to start up the program, rather than to
incur a SEGV when the subroutine is entered.
One more thing that you referred to, but that deserves to be
emphasized, is something that Sergio Gelato also mentioned to
me in email. I started this thread by saying that I wished that
the Fortran standard would mandate a program STOP when an automatic
cannot be allocated. Sergio -- and you, but less explicitly, I
think -- pointed out that this also pertains to temporary arrays
that the run-time system allocates.
As we go from ALLOCATABLE arrays to automatic arrays, we are going
from an explicit to an implicit dynamic memory request. When we go
from these to a compiler-requested temporary array, we are going to
a completely hidden memory request. Clearly, these can cause the
same problems as automatics when allocation fails, and the standard
should mandate more graceful error handling for these arrays as
well -- even if the program is merely stopped on failure to allocate.
-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 *
next prev parent reply other threads:[~1998-03-20 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
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 [this message]
1998-03-20 5:00 ` Richard Maine
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 ` Summary (I hope) failure of automatic allocation; was, " Peter Shenkin
1998-03-24 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-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 ` 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