On Thu, Oct 9, 2025 at 7:26 AM Nikolaos Chatzikonstantinou
<[email protected]> wrote:
>
> On Sun, Sep 21, 2025 at 12:47 AM Nikolaos Chatzikonstantinou
> <[email protected]> wrote:
> >
> > Hello bug-guile,
> >
> > I have a structure (srfi srfi-9 gnu) that keeps parts of strings in a
> > binary tree (it's a rope). The intention was to have it immutable, so
> > I used substring/shared. I kept getting errors on my unit tests when I
> > referenced individual characters; I could not replicate these errors
> > on the REPL. Eventually I realized that substring/shared caused them.
>
> I want to offer a small (<100 LoC) reproducible example now. I'm using
> 3.0.10. Try to run the test suite with autocompilation disabled
> (--no-auto-compile), and you should get failure (if success, try
> running again, rarely it succeeds.) If you compile the test.scm file,
> then it should work fine.
>
> I am not sure that I can figure this one out myself further, but
> somehow it is related to my projects tests being left uncompiled. Does
> anyone have an insight to the problem here?

Here is an even smaller reproducible example (see attached). It's one
module with the function

  (define-public (string-ref-0 s) (string-ref s 0))

which fails this test:

  (test-eqv "ref with zero index."
    (string-ref "hello" 0)
    (string-ref-0 (substring/shared "hello" 0 1)))

Instructions to reproduce the bug are in README.md. I checked that it
is still a bug in HEAD.

Regards,
Nikolaos Chatzikonstantinou

Attachment: guile-string-shared-bug-v0.1.tar.gz
Description: application/gzip

Reply via email to