From: Dennis Hoppe <dennis.hoppe@hoppinet.de>
Subject: Re: Error: "could not understand bounds information on packed array"
Date: Fri, 29 May 2009 13:58:47 +0200
Date: 2009-05-29T13:58:47+02:00 [thread overview]
Message-ID: <gvoim5$umb$1@aioe.org> (raw)
In-Reply-To: gvncrh$n52$3@aioe.org
Now, I am sure it is "just" a recursion issue. The following test
terminates after just 87.354 iterations:
with Ada.Text_IO; use Ada.Text_IO;
procedure Testsuite is
procedure Recursive_Call (Index : in out Integer) is
begin
Index := Index + 1;
Ada.Text_IO.Put_Line (Integer'Image (Index));
Recursive_Call (Index);
end Recursive_Call;
begin
declare
I : Integer := 0;
begin
Recursive_Call (I);
Ada.Text_IO.Put_Line (Integer'Image (I));
end;
end Testsuite;
Output:
[..]
87354
raised STORAGE_ERROR : stack overflow
Well, I didn't provide a suitable base case for termination. I just
wanted do find out the upper bound of recursive calling.
For me, 87.354 seems to be a very low upper bound of recursion. An
adapted version in Java runs 519.045 recursion steps before a
StackOverflowError occurs on the same machine.
It is clear, that I cannot indefinitely call a procedure recursively.
Unfortunately, I cannot predict in advance, how many recursion steps
my program have to proceed. How can I avoid the stack overflow in
recursion? Can I influence the upper bound of recursive calls, i.e the
size of the run-time stack?
Thank you,
Dennis
next prev parent reply other threads:[~2009-05-29 11:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-29 0:55 Error: "could not understand bounds information on packed array" Dennis Hoppe
2009-05-29 1:13 ` Dennis Hoppe
2009-05-29 11:58 ` Dennis Hoppe [this message]
2009-05-29 11:56 ` Per Sandberg
2009-05-29 13:02 ` John B. Matthews
2009-05-29 13:46 ` Dennis Hoppe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox