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

 
 

bug #36429: Compiler mysteriously runs out of stack space

Submitted by:  None
Submitted on:  Mon 07 May 2012 09:21:01 PM UTC  
 
Category: compilerSeverity: 3 - Normal
Priority: 5 - NormalItem Group: None
Status: FixedPrivacy: Public
Assigned to: NoneOriginator Name: Alexey Radul
Originator Email: -unavailable-Open/Closed: Closed
Keywords: 

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 File(s):
   
   
Comment:
   

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

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

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 02 Jun 2013 02:02:36 AM UTCmhbStatusNone=>Fixed
      Open/ClosedOpen=>Closed
    Mon 07 May 2012 09:21:01 PM UTCNoneAttached File-=>Added foo.scm, #25815

    Back to the top


    Powered by Savane 3.1-cleanup