This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Bug in shared substrings?


This bit of code seems to demonstrate a bug with shared substrings. Can
someone confirm this, or else point out my mistake?

Normally I'd spend some time to investigate this more, but with a
release being talked about soon, I wanted to get this out rapidly.

Thanks.

(define (no-bug text)
  (let ((p (string-index text #\X)))
    (if p
	(begin (string-set! text p #\_)
	       (no-bug text)))))


(define (bug text)
  (let ((p (string-index text #\X)))
    (if p
	(begin (string-set! text p #\_)
	       (bug (make-shared-substring text (+ p 1)))))))

(write-line "Correct")
(define x "111X222X333X444X555")
(write-line x)
(no-bug x)
(write-line x)

(write-line "Buggy")
(define x "111X222X333X444X555")
(write-line x)
(bug x)
(write-line x)