Re: stack overflow at compile time

glen herrmannsfeldt <gah@ugcs.caltech.edu>
28 Apr 2006 23:48:29 -0400

          From comp.compilers

Related articles
stack overflow at compile time jatin.bhateja@conexant.com (Jatin Bhateja) (2006-04-27)
Re: stack overflow at compile time NOSPAMrszeflerNOSPAM@murator.com.pl (RobertSzefler) (2006-04-27)
Re: stack overflow at compile time vb@compilers.de (Volker Barthelmann) (2006-04-27)
Re: stack overflow at compile time nitin@CoWare.com (Nitin Gupta) (2006-04-27)
Re: stack overflow at compile time henry@spsystems.net (2006-04-27)
Re: stack overflow at compile time gah@ugcs.caltech.edu (glen herrmannsfeldt) (2006-04-28)
Re: stack overflow at compile time jvorbrueggen@mediasec.de (=?ISO-8859-1?Q?Jan_Vorbr=FCggen?=) (2006-04-28)
Re: stack overflow at compile time jatin.bhateja@conexant.com (Jatin Bhateja) (2006-04-28)
Re: stack overflow at compile time emailamit@gmail.com (Amit Gupta) (2006-04-29)
Re: stack overflow at compile time bobduff@shell01.TheWorld.com (Robert A Duff) (2006-04-29)
Re: stack overflow at compile time emailamit@gmail.com (Amit Gupta) (2006-04-30)
Re: stack overflow at compile time henry@spsystems.net (2006-04-30)
[3 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: 28 Apr 2006 23:48:29 -0400
Organization: Compilers Central
References: 06-04-157 06-04-161
Keywords: storage, analysis
Posted-Date: 28 Apr 2006 23:48:29 EDT

Henry Spencer wrote:
(snip on stack size bounds at compile time)


> This is true, but uninteresting. :-) All real programs are special cases
> of one kind or another, as witness the fact that human beings reason
> effectively (if not always correctly) about their programs' halting
> behavior all the time.


> In the absence of recursion or non-trivial dynamic allocation, bounding
> stack size at compile time is obviously a straightforward problem:
> generate the call graph, label each arc with the stack size of the routine
> being called, and find the greatest "distance" from the root to a leaf.
> The maximum may occur on a path that's actually impossible, but at least
> you do get a bound.


But it is difficult to tell at compile time which routines are actually
called, even though you may know there is no recursion and only fixed
sized allocation. You could, then, way overestimate the stack usage.


With recursion you could easily underestimate it, not knowing the
maximum recursion level.


-- glen



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.