-
Notifications
You must be signed in to change notification settings - Fork 381
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Invalid memory reference on Chez backend #1974
Comments
Actually, I don't think this is a bug of the chez backend: The problem is already there when the For instance, when I look at the code generated by the JS backend, we were just lucky that it worked correctly in this case. |
I may have hit this on javascript, here's what the error looks like:
When compiling with chez backend, I get |
I hit this error in my program as well . Not a nice experience. What can be a workaround? In my case it is a recursive function with a LazyList. |
The following code behaves correctly on the JS backend but not on the default Chez Scheme backend. This occurred in a larger code base of mine, and breaking it down to the example below took quite some time. It might still not be minimal, though:
Steps to Reproduce
Compile and run the following example:
Expected Behavior
Prints
(1, 1)
.Observed Behavior
Fails with:
Exception: invalid memory reference. Some debugging context lost
Now, I had a look at the generated Scheme code, and the culprit is the second pattern match in function
step
(I'll add a properly indented version of it below): Instead of matching against theMSF
constructor, the generated Scheme performs anull?
check against the pair argument. Pairs are treated asCONS
constructors internally, so the Chez codegen performs this check to distinguish theCONS
case from theNIL
case. However,null?
returns#f
for everything that is not an empty list (the number we pass as an argument in our case), and the wrong branch is entered, leading to the exception described below.Finally, if I change the implementation of
step
to the following version, the program runs correctly:The text was updated successfully, but these errors were encountered: