unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#31474: logxor+ash trigger compilation bug?
@ 2018-05-16 18:16 Jan Nieuwenhuizen
  2018-05-28  2:13 ` Mark H Weaver
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Nieuwenhuizen @ 2018-05-16 18:16 UTC (permalink / raw)
  To: 31474

Hi!

Trying to implement bit-fields for MesCC, I stumble upon this.  I was
looking for a bitwise left shift that introduces 1's instead of zeros.

This code

--8<---------------cut here---------------start------------->8---
;; foo.scm
(let* ((set-mask (pk 'set-mask (ash 3 3)))
       (clear-mask (pk 'clear-mask (logxor set-mask -1))))
  (pk 'expected (logxor 24 -1))
  (display clear-mask)
  (newline)
  clear-mask)
--8<---------------cut here---------------end--------------->8---

behaves as I expect when compilation is turned off (compile or
auto-compile behave alike for me)

--8<---------------cut here---------------start------------->8---
19:50:43 janneke@dundal:~/src/mes 
$ guile --no-auto-compile foo.scm

;;; (set-mask 24)

;;; (clear-mask -25)

;;; (expected -25)
-25
--8<---------------cut here---------------end--------------->8---

but when (auto)compiled, look:

--8<---------------cut here---------------start------------->8---
19:50:47 janneke@dundal:~/src/mes 
$ guile foo.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/janneke/src/mes/foo.scm
;;; compiled /home/janneke/.cache/guile/ccache/2.2-LE-8-3.A/home/janneke/src/mes/foo.scm.go

;;; (set-mask 24)

;;; (clear-mask -1)

;;; (expected -25)
-1
--8<---------------cut here---------------end--------------->8---

I'm using guile-2.2.3 from Guix master.

Is this a bug, can you suggest a workaround?

Greetings,
janneke

-- 
Jan Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond http://lilypond.org
Freelance IT http://JoyofSource.com | Avatar® http://AvatarAcademy.com





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

end of thread, other threads:[~2018-06-11 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-16 18:16 bug#31474: logxor+ash trigger compilation bug? Jan Nieuwenhuizen
2018-05-28  2:13 ` Mark H Weaver
2018-05-28 12:03   ` Mark H Weaver
2018-05-28 21:17     ` Jan Nieuwenhuizen
2018-06-11 14:28       ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).