bugProgramming from the Ground Up Book - Bugs: bug #19918, factorial doesn't dispose of the...

 
 

bug #19918: factorial doesn't dispose of the parameters pushed on the stack after it returns from the resursion

Submitter:  None
Submitted:  Mon 21 May 2007 11:33:31 AM UTC
   
 
Category:  None Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
* Mandatory Fields

Post a Comment

Add a New Comment Rich Markup
   

Discussion

Sun 21 Oct 2007 05:27:52 PM UTC, comment #1: 

Yes, it does.  Each inner stack frame is destroyed just before the `ret' instruction call as the recursion works its way back out from the base case.

Jonathon <jwdonal>
Mon 21 May 2007 11:33:31 AM UTC, original submission:  

I'm reading version 1.0 of the book. The factorial function in the "Recursive Functions" section of Chapter 4 calls itself to compute the factorial of the number minus one but once the call returns, the pushed value is not disposed of. It's in contrast with what _start does when it calls factorial and the book advice which states that "You should always clean up your stack parameters after a function call returns."

Anonymous

 

Attached Files

This item currently has no attached files.

(Note: upload size limit is set to 4.0MiB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Dependencies

This item does not depend on any other items.

No items depend on this one.

 

Mail Notification Carbon-Copy List

Carbon-Copy List
  • -email is unavailable- added by jwdonal (Posted a comment)
  •  

    Votes

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    History

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.16-ed84.
    Corresponding source code