public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
* internal compile error
@ 2013-01-16 22:12 Ito Kazumitsu
  2013-01-17  7:37 ` Per Bothner
  0 siblings, 1 reply; 3+ messages in thread
From: Ito Kazumitsu @ 2013-01-16 22:12 UTC (permalink / raw)
  To: kawa

Hi,

I have found a simple case where internal compile error occurs.
As shown below, Gauche and Guile runs the script normally.

$ cat 0.scm
(let loop ((n 1))
  (cond
    ((= n 0) #t)
    ((and n (if #f #f)) (loop (- n 1)))))
$ gosh 0.scm
$ guile --no-auto-compile 0.scm
$ java -cp kawa-1.13.jar kawa.repl --script 0.scm
0.scm:4:6: internal compile error - caught java.lang.Error: popType called with empty stack atInteractiveLevel$1.run(gnu.mapping.CallContext)void
    gnu.bytecode.CodeAttr.popType(CodeAttr.java:442)
    gnu.bytecode.CodeAttr.emitGotoIfCompare1(CodeAttr.java:1627)
    gnu.bytecode.CodeAttr.emitGotoIfIntEqZero(CodeAttr.java:1633)
    gnu.expr.ConditionalTarget.compileFromStack(ConditionalTarget.java:52)
    gnu.expr.QuoteExp.compile(QuoteExp.java:124)
    gnu.expr.Expression.compileWithPosition(Expression.java:130)
    gnu.expr.IfExp.compile(IfExp.java:123)
    gnu.expr.IfExp.compile(IfExp.java:52)
    gnu.expr.IfExp.compile(IfExp.java:114)
    gnu.expr.IfExp.compile(IfExp.java:52)
    gnu.expr.Expression.compileWithPosition(Expression.java:130)
    gnu.expr.LetExp.compile(LetExp.java:193)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.IfExp.compile(IfExp.java:137)
    gnu.expr.IfExp.compile(IfExp.java:52)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.ApplyExp.compile(ApplyExp.java:333)
    gnu.expr.ApplyExp.compile(ApplyExp.java:132)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.BeginExp.compile(BeginExp.java:153)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:127)
    gnu.expr.LetExp.compile(LetExp.java:193)
    gnu.expr.Expression.compileNotePosition(Expression.java:156)
    gnu.expr.Expression.compileWithPosition(Expression.java:142)
    gnu.expr.LambdaExp.compileBody(LambdaExp.java:1722)
    gnu.expr.Compilation.generateBytecode(Compilation.java:2080)
    gnu.expr.Compilation.process(Compilation.java:1957)
    gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:305)
    gnu.expr.ModuleExp.evalToClass(ModuleExp.java:59)
    gnu.expr.ModuleExp.evalModule1(ModuleExp.java:251)
    gnu.expr.ModuleExp.evalModule(ModuleExp.java:205)
    kawa.Shell.run(Shell.java:279)
    kawa.Shell.runFile(Shell.java:486)
    kawa.Shell.runFileOrClass(Shell.java:420)
    kawa.repl.processArgs(repl.java:274)
    kawa.repl.main(repl.java:869)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: internal compile error
  2013-01-16 22:12 internal compile error Ito Kazumitsu
@ 2013-01-17  7:37 ` Per Bothner
  2013-01-17 21:49   ` Ito Kazumitsu
  0 siblings, 1 reply; 3+ messages in thread
From: Per Bothner @ 2013-01-17  7:37 UTC (permalink / raw)
  To: Ito Kazumitsu; +Cc: kawa

On 01/16/2013 02:11 PM, Ito Kazumitsu wrote:
> Hi,
>
> I have found a simple case where internal compile error occurs.

Thanks.  I looked into it.  I have a fix for this specific case, but
there are some related issues with void-valued expressions.  One is
I'd like to enhance the compiler so it emits a warning (or possibly
an error) when it sees this kind of use of a void value.

> As shown below, Gauche and Guile runs the script normally.

Well, "running the script normally" is not well-defined given
that the script depends on an unspecified value.
-- 
	--Per Bothner
per@bothner.com   http://per.bothner.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: internal compile error
  2013-01-17  7:37 ` Per Bothner
@ 2013-01-17 21:49   ` Ito Kazumitsu
  0 siblings, 0 replies; 3+ messages in thread
From: Ito Kazumitsu @ 2013-01-17 21:49 UTC (permalink / raw)
  To: kawa


>> As shown below, Gauche and Guile runs the script normally.
> 
> Well, "running the script normally" is not well-defined given
> that the script depends on an unspecified value.

I had a misunderstanding that an unspecified value is something
special, at least something other than #f.  Referring to R5RS,
I understand that an unspecified value is implementation-dependent,
so it may or may not be #f.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-01-17 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-16 22:12 internal compile error Ito Kazumitsu
2013-01-17  7:37 ` Per Bothner
2013-01-17 21:49   ` Ito Kazumitsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).