[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/08: base32: Work around (ash x N) miscompilation at '-O1' and below.
From: |
guix-commits |
Subject: |
01/08: base32: Work around (ash x N) miscompilation at '-O1' and below. |
Date: |
Tue, 21 Sep 2021 09:16:52 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit baa0aa1348aa5fe526425efbf11707d8e02a2640
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Tue Sep 21 09:43:53 2021 +0200
base32: Work around (ash x N) miscompilation at '-O1' and below.
Fixes <https://issues.guix.gnu.org/50696>.
Reported by Marius Bakke <marius@gnu.org>.
* guix/base32.scm (bit-field): Introduce 'minus-start' syntax and use it.
---
guix/base32.scm | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/guix/base32.scm b/guix/base32.scm
index d6c8a02..8f097d4 100644
--- a/guix/base32.scm
+++ b/guix/base32.scm
@@ -53,7 +53,15 @@
(let* ((s (syntax->datum #'start))
(e (syntax->datum #'end))
(mask (- (expt 2 (- e s)) 1)))
- #`(logand (ash n (- start)) #,mask))))))
+ ;; The baseline compiler in Guile <= 3.0.7 miscompiles (ash x N) as
+ ;; (ash x (- N)) when N is a literal: <https://bugs.gnu.org/50696>.
+ ;; Here we take advantage of another bug in the baseline compiler,
+ ;; fixed in Guile commit 330c6ea83f492672578b62d0683acbb532d1a5d9: we
+ ;; introduce 'minus-start' such that it has a different source
+ ;; location, which in turn means that the baseline compiler pattern
+ ;; for (ash x N) doesn't match, thus avoiding the bug (!).
+ (with-syntax ((minus-start (datum->syntax #'start (- s))))
+ #`(logand (ash n minus-start) #,mask)))))))
(define bytevector-quintet-ref
(let* ((ref bytevector-u8-ref)
- branch master updated (39414b7 -> 9102512), guix-commits, 2021/09/21
- 02/08: gnu: erlang: Update to 24.0.5., guix-commits, 2021/09/21
- 06/08: gnu: imv: Update to 4.1.0 and adjust arguments+inputs., guix-commits, 2021/09/21
- 04/08: etc: committer: Amend previous commit if a copyright line was added., guix-commits, 2021/09/21
- 08/08: news: Add entry for "guix graph -M"., guix-commits, 2021/09/21
- 05/08: gnu: patchutils: Update to 0.4.2., guix-commits, 2021/09/21
- 07/08: graph: Add '--max-depth'., guix-commits, 2021/09/21
- 01/08: base32: Work around (ash x N) miscompilation at '-O1' and below.,
guix-commits <=
- 03/08: gnu: elixir: Update to 1.12.2., guix-commits, 2021/09/21