ashinn / chibi-scheme

Official chibi-scheme repository
Other
1.21k stars 142 forks source link

equal? from (scheme base) not halting when it should #929

Closed sham1 closed 3 months ago

sham1 commented 1 year ago

Earlier today, I noticed a bug when I inputted the following forms in the REPL:

(import (scheme base))
(equal? '#1=(#1# . #1#) '#2=(#2# . #2#))

Instead of this halting as expected and required by R7RS, it instead goes into an infinite loop.

ashinn commented 3 months ago

This isn't related to equal?, it's the compiler not supporting raw cyclic literals in the source:

This hangs as well:

((lambda (a b) #t) '#1=(#1# . #1#) '#2=(#2# . #2#))

and supporting that is a very low priority. This, however, currently gives me a segfault:

 (let ((a (cons 1 2)) (b (cons 3 4)))
  (set-car! a a)
  (set-cdr! a a)
  (set-car! b b)
  (set-cdr! b b)
  (equal? a b))

will take a look.

ashinn commented 3 months ago

We were blowing the stack, reduced the bound in 045bb1813c0274e4110c35734682b32155e28bd3.