unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#48368: eq? problem at -O2 since Guile 3.0.5
@ 2021-05-11 20:49 Marius Bakke
  2021-05-24  8:14 ` bug#48368: reduced test case Andy Wingo
  2021-05-24 12:19 ` bug#48368: thanks Andy Wingo
  0 siblings, 2 replies; 3+ messages in thread
From: Marius Bakke @ 2021-05-11 20:49 UTC (permalink / raw)
  To: 48368

[-- Attachment #1: Type: text/plain, Size: 1180 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 247 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#48368: reduced test case
  2021-05-11 20:49 bug#48368: eq? problem at -O2 since Guile 3.0.5 Marius Bakke
@ 2021-05-24  8:14 ` Andy Wingo
  2021-05-24 12:19 ` bug#48368: thanks Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2021-05-24  8:14 UTC (permalink / raw)
  To: 48368

Test case:

  (define (f a b)
    (let ((c (if (and (eq? a 'foo)
                      (eq? b 'bar))
                 'ERROR
                 a)))
      (pk c)))

If you run as (f 'not-foo 'bar), you get 'ERROR.  Yeeps!





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#48368: thanks
  2021-05-11 20:49 bug#48368: eq? problem at -O2 since Guile 3.0.5 Marius Bakke
  2021-05-24  8:14 ` bug#48368: reduced test case Andy Wingo
@ 2021-05-24 12:19 ` Andy Wingo
  1 sibling, 0 replies; 3+ messages in thread
From: Andy Wingo @ 2021-05-24 12:19 UTC (permalink / raw)
  To: 48368-done

Fixed in 17aab66e75136cf23c7f0d4942b61d6947f98f9b.  Thanks for the
report :)





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-24 12:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11 20:49 bug#48368: eq? problem at -O2 since Guile 3.0.5 Marius Bakke
2021-05-24  8:14 ` bug#48368: reduced test case Andy Wingo
2021-05-24 12:19 ` bug#48368: thanks Andy Wingo

unofficial mirror of bug-guile@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/guile-bugs/0 guile-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 guile-bugs guile-bugs/ https://yhetil.org/guile-bugs \
		bug-guile@gnu.org
	public-inbox-index guile-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.lisp.guile.bugs
	nntp://news.gmane.io/gmane.lisp.guile.bugs


AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git