bugMIT/GNU Scheme - Bugs: bug #36429, Compiler mysteriously runs out of...

 
 

bug #36429: Compiler mysteriously runs out of stack space

Submitter:  None
Submitted:  Mon 07 May 2012 09:21:01 PM UTC
   
 
Category:  compiler Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Fixed Privacy:  Public
Assigned to:  None Originator Name:  Alexey Radul
Originator Email:  -email is unavailable- Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 02 Jun 2013 02:02:36 AM UTC, comment #1: 

Here is a smaller bit o' code that causes the infinite recursion.

(define (bug)
  (define (fubar param)
    (define (closure) param)
    (define (loop)
      (closure)
      ;; The bug turned out to be here: unavoidable self-call
      (loop)
      ;; It doesn't break without this
      (tail-call)))
  (fubar sumpn))

The trouble starts when continuation analysis decides the continuation after (loop) is the stack-link for loop.  This causes block->dbg-block to infinitely recurse via the bad link.

Commit 78d42fa avoids choosing an inner block.

Matt Birkholz <mhb>
Group Member
Mon 07 May 2012 09:21:01 PM UTC, original submission:  

Hi all,

I stumbled across a bug that causes the compiler to exhaust its
recursion depth.  The enclosed file produces the following bizarre
interaction in a fresh MIT Scheme:

MIT/GNU Scheme running under GNU/Linux
Type `^C' (control-C) followed by `H' to obtain information about interrupts.

Copyright (C) 2011 Massachusetts Institute of Technology
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Image saved on Tuesday November 8, 2011 at 10:45:46 PM
  Release 9.1.1     || Microcode 15.3 || Runtime 15.7 || SF 4.41
  LIAR/x86-64 4.118 || Edwin 3.116

1 ]=> (cf "foo")

;Generating SCode for file: "foo.scm" => "foo.bin"...
;Warning: Unreferenced defined variable: face-color-list
;... done
;Compiling file: "foo.bin" => "foo.com"... aborted
;Aborting!: maximum recursion depth exceeded

1 ]=>

I would not expect reasonably normal code to make the compiler run
out of stack.

Now, the enclosed file does contain a mistake: one of the procedures
defined therein always recursively calls itself (and even not in
tail position).  However, my attempts to produce a small example
using this to cause the compiler to run out of stack failed.  I also
got very confused when I tried to reduce the present example,
because commenting out a form I would not have expected to have
anything to do with anything caused the misbehavior to disappear.

Cheers,
~Alexey

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #25815:  foo.scm added by None (3KiB - text/x-scheme)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mhb (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-06-02 mhb StatusNone Fixed
        Open/ClosedOpen Closed
    2012-05-07 None Attached File- Added foo.scm, #25815

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code