bug#48368: eq? problem at -O2 since Guile 3.0.5

Marius Bakke <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <[email protected]>
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)

https://git.savannah.gnu.org/cgit/shepherd.git/tree/modules/shepherd/scripts/herd.scm#n124

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.
signature.asc (application/pgp-signature, 247 B)
-----BEGIN PGP SIGNATURE-----

iIUEARYKAC0WIQRNTknu3zbaMQ2ddzTocYulkRQQdwUCYJrtzw8cbWFyaXVzQGdu
dS5vcmcACgkQ6HGLpZEUEHe4hQEAknNS0PVUkTkz0Wy3x/S3Qu50FowvKcMDxmKx
nsISOG8BALKLfG7ywwYVOnuC73czgpEaLT3EMzjBdGHnh7Tu6wEO
=4y51
-----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.