Subject: Re: bug#43326: [3.0.x] Regression: Compilation error involving strings

From: <[email-masked]>
Date: Fri, 11 Sep 2020 14:37:43 +0200

On Fri, Sep 11, 2020 at 03:31:24PM +0700, Erik Dominikus wrote:
> Dear author(s) of the Guile 3.0.x compiler,
> 
> Background: I would like to report a problem that I found while trying
> to write a simple web server with get-string-n, sxml simple, and web
> server.
> 
> I have traced and reduced the problem into the minimal example below.
> 
> Some tested versions:
> - affected: 3.0.2 and 3.0.4
> - not affected: 2.0.13
> 
> How to reproduce:
> - Download the attached compile-error.scm into your working directory.
> - Run in Bash: GUILE_AUTO_COMPILE=0 guile -s compile-error.scm
> 
> Expected result: #t
> 
> Actual result: #f
> 
> Thank you.
> 
> Best regards,
> 
> Erik

> ;; GUILE_AUTO_COMPILE=0 guile -s compile-error.scm
> (define code '(lambda ()
>                 (define a (string #\x #\y))
>                 (define b (substring/shared a 0 1))
>                 (string-ref b 0)))
> (define compiled (compile code))
> (define interped (eval code (interaction-environment)))
> (write (equal? (compiled) (interped))) ;; #\nul vs #\x
> (newline)

Interesting: replacing "substring/shared" with just "substring" seems
to "fix" it (FWIW: the compiled version with "substring/shared" returns
"#\nul" (unexpected, for me), whereas the one with just "substring"
returns "#\x" (expected).

Cheers
 - t