bug#62053: Guile compiler is unable to compile tiny program

<[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
On Wed, Mar 08, 2023 at 02:07:56PM +0300, var-vniiaes--- via Bug reports for GUILE, GNU's Ubiquitous Extension Language wrote:
> 
> Guile compiler is unable to compile tiny program:
>  
> (define (fn l)
>     (define (ok l)
>        (or (and (pair? l) l)
>            (error "list is empty")))
>     (cons (reverse (car l)) (ok l)))
>  
> amaya@picasso:~/tmp/guile-3.0.9
> $ ../prefix/bin/guile ~/tmp/guile-compiler-bug.scm
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;;       or pass the --no-auto-compile argument to disable.
> ;;; compiling /home/amaya/tmp/guile-compiler-bug.scm
> ;;; WARNING: compilation of /home/amaya/tmp/guile-compiler-bug.scm failed:
> ;;; not found 22
>  
> Compiler reports confusing message here: `not found 22’.   

Bizarre. Can confirm 

tomas@trotzki:~/foo$ vim buggy.scm
  tomas@trotzki:~/foo$ guile buggy.scm 
  ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
  ;;;       or pass the --no-auto-compile argument to disable.
  ;;; compiling /home/tomas/foo/buggy.scm
  ;;; /home/tomas/foo/buggy.scm:2:0: warning: possibly unbound variable `#{   }#'
  ;;; /home/tomas/foo/buggy.scm:3:0: warning: possibly unbound variable `#{      }#'
  ;;; /home/tomas/foo/buggy.scm:4:0: warning: possibly unbound variable `#{          }#'
  ;;; WARNING: compilation of /home/tomas/foo/buggy.scm failed:
  ;;; not found 25

  tomas@trotzki:~/foo$ guile --version
  guile (GNU Guile) 3.0.8.57-bc3b1
  Copyright (C) 2022 Free Software Foundation, Inc.

  License LGPLv3+: GNU LGPL 3 or later <http://gnu.org/licenses/lgpl.html>.
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.

(so in my case it's 25 instead of 22). Interestingly, my version also
produces warnings about possibly unbound variables). If I enter the
code line by line into a repl, I also get a "not found 22".

Interestingly, if I add a call to fn to the end of that snippet
(e.g. (fn '(a b))), the "not found" disappears. The unbound var
warnings stay.

Cheers
-- 
t
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZAi6qAAKCRAFyCz1etHa
RjzDAJ43hVUIaJJwDwWq19T7qDYGUNgCpwCfb57K09FDPG50NzJnzTIHohMQPSs=
=Dnvi
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.