Opened 6 years ago
Closed 6 years ago
#1601 closed defect (fixed)
Infinite continuation loop corrupts stack(?)
Reported by: | Moritz Heidkamp | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 5.1 |
Component: | unknown | Version: | 5.0.0 |
Keywords: | Cc: | ||
Estimated difficulty: | hard |
Description
This program:
(let ((loop #f)) (call/cc (lambda (f) (set! loop f))) (print 123) (loop))
prints lines of "123" for a while until it aborts with this error:
[panic] Detected corrupted data in stack - execution terminated
Change History (10)
comment:1 Changed 6 years ago by
comment:2 Changed 6 years ago by
Estimated difficulty: | → hard |
---|---|
Milestone: | someday → 5.1 |
comment:3 Changed 6 years ago by
In CHICKEN 4, we get an error that loop
is invoked without any arguments. If I change the call so it's (loop loop)
, it does not error in C5.
This could point to a problem with the number of arguments the continuation is invoked versus how it is expected to be invoked. Strictly speaking, it shouldn't care about the number of arguments (given that it doesn't do anything with the value(s) returned by the call/cc
call).
comment:5 Changed 6 years ago by
I've also noticed that (receive (x) (call/cc (lambda (f) 1 (values))) (print x))
does not error out; it prints #<unspecified>
, which is definitely wrong.
comment:6 Changed 6 years ago by
That expands to (##core#let ((x (call/cc (lambda (f) (values))))) (print x))
and this doesn't work. An explicit call to call-with-values
works.
comment:7 Changed 6 years ago by
Simplified, this gives unspecified too: (let ((x (values))) (print x))
comment:10 Changed 6 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Fixed with 3e0f640ecf22f6be7af1947b875132415556ca5b (not signed-off, but discussed at SaarCHICKEN)
Just found out that adding an explicit
(gc)
to the loop fixes the problem. So apparently the GC doesn't realize that it needs to do its job here :-)