Peter Shenkin wrote:
[discussion of stack overflow]
>
> The new C standard (C99) has the same problem. C99 has
> VLA's (variable-length arrays) which, when used as
> local variables, are exactly like F90's automatic arrays.
> Stack overflow leads to SEGV.
>
> However, there is a proposal for the next C standard to
> provide a means of identification and graceful exit when
> the problem occurs. The proposal was written by David Tribble,
> and I think I can claim credit for bitching and griping loudly
> enough over comp.std.c so that people began to recognize the
> problem and see the need for addressing it.
>
> Unfortunately, my Fortran colleagues seem not to be convinced
> that this needs addressing.
>
> -P.
How would it work? It's come up briefly at a couple of J3 meetings
and, I think, floundered because Fortran doesn't really have an
exception trapping mechanism. What would you expect to have happen
for
print *, big_array*big_array .user_op. something
...
function implements_user_op(a,b)
...
integer temp(size(b))
character(len=size(a))
integer temp2(user_function(3))
integer scalar_straw_that_breaks_back
...
stack overflows are possible on every line. If one occurs
where should control be passed? What should the print do?
It's easy (well possible anyhow) to develop some rules if Fortran
had a general exception catcher. But even then it's unclear (to me)
whether an allocate failure for e. g. temp should go to a catcher in
implements_user_op or to one in the print's routine. Ditto for
a failure in user_function. Especially if the error handler wants
to print a helpful message.
I think the fact that there are lots of "obvious" ways to do it
makes it hard to get agreement.
Could you give an outline of what is proposed for C? There's no
big hurry as I think the F2K train is full and there isn't room
for any more good ideas.
Dick Hendrickson
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|