comp.lang.ada
 help / color / mirror / Atom feed
* Storage Error
@ 1990-11-13  0:22 Tom Gargulak
  1990-11-13  3:51 ` Brian Hanafee
  1990-11-13 18:23 ` Tom Gargulak
  0 siblings, 2 replies; 5+ messages in thread
From: Tom Gargulak @ 1990-11-13  0:22 UTC (permalink / raw)


I got the following example from the book by Barnes (pg. 183).  Barnes 
claims that this program should raise the STORAGE_ERROR exception
and I agree due to 11.4.1(10) in the LRM.  A colleague believes that
Barnes is mistaken and that it would be acceptable for the program
to run forever.  He claims it depends how the stack is implemeted.

Barnes claims the following should happen:


    |		n-3	B				H	
    |		n-2	B		H		B
    |		n-1	B	H	B	H	B
    V		n	*	*	*	*	*

Invocation	--------------------------------------->time

B - executing in the procedure body for invocation n-m
H - executing in the exception handler for invocation n-m
* - a call which failed due to STORAGE_ERROR


Does anyone know what should happen and why?


Thanks,
Tom

--------------------------------cut here----------------------------

procedure P is
begin
  P;
exception
  when others =>
    P;
end;

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storage Error
  1990-11-13  0:22 Storage Error Tom Gargulak
@ 1990-11-13  3:51 ` Brian Hanafee
  1990-11-13 18:23 ` Tom Gargulak
  1 sibling, 0 replies; 5+ messages in thread
From: Brian Hanafee @ 1990-11-13  3:51 UTC (permalink / raw)


In article <108637@convex.convex.com> gargulak@mozart.convex.com (Tom Gargulak) writes:
>I got the following example from the book by Barnes (pg. 183).  Barnes 
>claims that this program should raise the STORAGE_ERROR exception
>and I agree due to 11.4.1(10) in the LRM.  A colleague believes that
>Barnes is mistaken and that it would be acceptable for the program
>to run forever.  He claims it depends how the stack is implemeted.
[stuff deleted]
>
>procedure P is
>begin
>  P;
>exception
>  when others =>
>    P;
>end;


I believe that there are three possible (implementation dependent)
behaviours for this program:

Case 1:
  The compiler generated code does not require any new storage for
each new invocation of P.  In this case, the program will not run out
of storage, and may acceptably run forever.

Case 2:
  If the implementation requires that each invocation of P uses some
new storage (such as stack space), then eventually an invocation of P
will cause a STORAGE_ERROR.  The invocation of P from the handler will
(presumably) cause a *new* STORAGE_ERROR to be raised.  Under
11.4.1(10), this exception will cause the program to raise
STORAGE_ERROR.

Case 3:
  After STORAGE_ERROR is first raised, the program could detect that the
invocation of P from the handler is erroneous, and raise PROGRAM_ERROR
instead.


------------------------------------------------------------------------
Brian Hanafee                    | **Standard Disclaimer**
Advanced Decision Systems        |
------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storage Error
  1990-11-13  0:22 Storage Error Tom Gargulak
  1990-11-13  3:51 ` Brian Hanafee
@ 1990-11-13 18:23 ` Tom Gargulak
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Gargulak @ 1990-11-13 18:23 UTC (permalink / raw)


[oops again]

One thing I failed to mention.  I assume that the program will raise
a storage_error exception due to the infinite recursion.  I realize
some compilers can optimize this into a loop.

So, assuming the exception occurs, will this program eventually 
terminate?  Why?

Thanks again,
Tom 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Storage error
@ 1998-07-20  0:00 Scott Sheffield
  1998-07-20  0:00 ` Stephen Leake
  0 siblings, 1 reply; 5+ messages in thread
From: Scott Sheffield @ 1998-07-20  0:00 UTC (permalink / raw)


I have a program that is compiling and building fine but draws a storage
error when it is run. I tried pragma suppress(storage_check) to try to
force it to run but it still raised a storage error. I'm not entirly
clear on what this is telling me and I have no idea how to resolve this
issue. Any help would be appreciated.

Scott




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Storage error
  1998-07-20  0:00 Storage error Scott Sheffield
@ 1998-07-20  0:00 ` Stephen Leake
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Leake @ 1998-07-20  0:00 UTC (permalink / raw)


Scott Sheffield <sheffieldsy@lmtas.lmco.com> writes:

> I have a program that is compiling and building fine but draws a storage
> error when it is run. I tried pragma suppress(storage_check) to try to
> force it to run but it still raised a storage error. I'm not entirly
> clear on what this is telling me and I have no idea how to resolve this
> issue. Any help would be appreciated.
> 
> Scott

Storage_Error means something is running out of memory; either heap or
stack. You may be declaring an unconstrained object with a huge index
(see the recent series of messages). You may have your stack size too
small. Or you may be doing something else. You'll have to post code to
get more help. Please include compiler brand and version, and OS brand
and version.

-- Stephe




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1998-07-20  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1990-11-13  0:22 Storage Error Tom Gargulak
1990-11-13  3:51 ` Brian Hanafee
1990-11-13 18:23 ` Tom Gargulak
  -- strict thread matches above, loose matches on Subject: below --
1998-07-20  0:00 Storage error Scott Sheffield
1998-07-20  0:00 ` Stephen Leake

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox