bugKawa - Bugs: bug #39150, AppendValue procedure compiler...


bug #39150: AppendValue procedure compiler InternalError

Submitted by:  Matthieu Vachon <maoueh>
Submitted on:  Mon Jun 3 13:55:30 2013  
Category: Code generationSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Per Bothner <bothner>
Open/Closed: Closed

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

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


Thu Jul 18 21:13:52 2013, comment #3:

Checked in fix and test-case. Thanks.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu Jul 18 07:20:30 2013, comment #2:

I've verified this with a slightly simpler test-case:

(define-simple-class <Simple> (<Object>)
(input type: <String> init-value: ""))

(define (main)

(let loop ()
(make <Simple> input: "value")

The problem appears to be related to the ALLOCATE_ON_STACK optimization. It's time for bed - I'll try to look at it tomorrow.

Per Bothner <bothner>
Project AdministratorIn charge of this item.
Thu Jul 18 01:39:39 2013, comment #1:

I saw that you made some inline optimization changes recently. I thought that those changes could have fixed this issue at the same time.

So, I fetched latest version (r7526) and tried it with the snippet below. An improvement has been made since I no longer see the exception when compiling the snippet.

However, the problem now arise when the class is loaded. It's a VerifyError saying the stack trace is inconsistent.

Matthieu Vachon <maoueh>
Mon Jun 3 13:55:30 2013, original submission:

Assume the following test case:

This does not compile, compiler shows an `InternalError` where it was compiling fine in version r6989. The bug was introduced in revision r6990.

The thing that happens in new version is that a tail call is process for the `ApplyExp(loop)`, at which point an `emitGoto(label)` is made where the label is the start of the scope of `LambdaExp(loop)`. In the `emitGoto(label)`, we ensure that `code.SP` has same length of `stackTypes` when its not null. But `code.SP` is 1 at point of crash but should be zero.

Removing the `input` field initializer for class <Simple> make compilation works. I dig up further this bug by stepping through the execution path what I found is that a type is pushed on the stack but not pop as it should. When there is not field initializer, the target is `IgnoreTarget` which pop the type if non-void. However, when `input` field initializer is present, the target is a `CheckedTarget` and the type on the stack is not pop and `code.SP` is left at 1. Since it is not 0 as expected, the compiler crash.

I attach the test case I used and also a subset of patch r6990 that can reproduce the error. So the whole patch is not a problem, only a part of it.


P.S Here the start of stack trace for the record:

Matthieu Vachon <maoueh>


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

Attach File(s):

Attached Files
file #28234:  appendvalueserror.scm added by maoueh (2kB - application/octet-stream - test case to reproduce problem & offending changeset (git patch))
file #28235:  AppendValuesErrorsOffendingDiff.patch added by maoueh (4kB - application/octet-stream - test case to reproduce problem & offending changeset (git patch))


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by bothner (Posted a comment)
  • -unavailable- added by maoueh (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 6 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Thu Jul 18 21:13:52 2013bothnerStatusConfirmed=>Fixed
    Thu Jul 18 07:20:30 2013bothnerStatusNone=>Confirmed
      Assigned toNone=>bothner
    Mon Jun 3 13:55:30 2013maouehAttached File-=>Added appendvalueserror.scm, #28234
      Attached File-=>Added AppendValuesErrorsOffendingDiff.patch, #28235

    Back to the top

    Powered by Savane 3.1-cleanup1