bugKawa - Bugs: bug #36863, then clause grows stack with no...

 
 

bug #36863: then clause grows stack with no else clause

Submitter:  Helmut Eller <ellerh>
Submitted:  Tue 17 Jul 2012 01:50:55 PM UTC
   
 
Category:  Code generation Severity:  3 - Normal
Item Group:  Compile-time exception Status:  Fixed
Privacy:  Public Assigned to:  bothner
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 07 Oct 2012 06:50:27 PM UTC, comment #1: 

I checked in a fix and the test case.  Sorry for the delay.

Per Bothner <bothner>
Group administrator
Tue 17 Jul 2012 01:50:55 PM UTC, original submission:  

This example

(define (first (iterable java.lang.Iterable))
  (let ((f (lambda (x) #t))
        (iter (iterable:iterator)))
    (let loop ()
      (if (iter:hasNext)
          (let ((item (iter:next)))
            (if (f item)
                item
                (loop)))
          #f))))


causes this error:

shell> kawa --version -C x.scm
Kawa 1.12.1 (revision 7274M)
Copyright (C) 2011 Per Bothner
(compiling x.scm to x)
x.scm:7: internal error while compiling x.scm
java.lang.Error: at PC 30 then clause grows stack with no else clause
        at gnu.bytecode.CodeAttr.emitFi(CodeAttr.java:1902)
        at gnu.expr.IfExp.compile(IfExp.java:138)
        at gnu.expr.IfExp.compile(IfExp.java:52)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.LetExp.compile(LetExp.java:193)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.IfExp.compile(IfExp.java:123)
        at gnu.expr.IfExp.compile(IfExp.java:52)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:327)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:126)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.BeginExp.compile(BeginExp.java:153)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.LetExp.compile(LetExp.java:193)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:127)
        at gnu.expr.LetExp.compile(LetExp.java:193)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:142)
        at gnu.expr.LambdaExp.compileBody(LambdaExp.java:1671)
        at gnu.expr.LambdaExp.compileAsMethod(LambdaExp.java:1647)
        at gnu.expr.LambdaExp.compileSetField(LambdaExp.java:689)
        at gnu.expr.SetExp.compile(SetExp.java:170)
        at gnu.expr.Expression.compileNotePosition(Expression.java:156)
        at gnu.expr.Expression.compileWithPosition(Expression.java:142)
        at gnu.expr.LambdaExp.compileBody(LambdaExp.java:1671)
        at gnu.expr.Compilation.generateBytecode(Compilation.java:2074)
        at gnu.expr.Compilation.process(Compilation.java:1952)
        at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:305)
        at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:290)
        at kawa.repl.compileFiles(repl.java:824)
        at kawa.repl.processArgs(repl.java:444)
        at kawa.repl.main(repl.java:870)


Helmut Eller <ellerh>

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bothner (Posted a comment)
  • -email is unavailable- added by ellerh (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
    2012-10-07 bothner StatusNone Fixed
        Assigned toNone bothner
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code