(address . bug-guile@gnu.org)
Hi!
I haven't been able to make a reproducer for this, but for illustrative
purposes, here is a code snippet that fails with -O2 on Guile 3.0.5 and
later (excerpt from GNU Shepherd):
(define (run-command socket-file action service args)
"Perform ACTION with ARGS on SERVICE, and display the result. Connect to
the daemon via SOCKET-FILE."
(with-system-error-handling
(let ((sock (open-connection socket-file))
(action* (if (and (eq? action 'detailed-status)
(memq service '(root shepherd)))
'status
action)))
;; Send the command.
(write-command (shepherd-command action* service #:arguments args)
sock)
At -O2, (eq? action 'detailed-status) evaluates to true no matter what
symbol ACTION holds.
Interestingly, adding (pk action*) between LET and WRITE-COMMAND gives
the expected result and mitigates the problem(!).
There are other issues that can be observed by running the Shepherd test
suite (i.e. make -j4 check). With -O1 all pass.
-----BEGIN PGP SIGNATURE-----
iIUEARYKAC0WIQRNTknu3zbaMQ2ddzTocYulkRQQdwUCYJrtzw8cbWFyaXVzQGdu
dS5vcmcACgkQ6HGLpZEUEHe4hQEAknNS0PVUkTkz0Wy3x/S3Qu50FowvKcMDxmKx
nsISOG8BALKLfG7ywwYVOnuC73czgpEaLT3EMzjBdGHnh7Tu6wEO
=4y51
-----END PGP SIGNATURE-----