MSYS2-packages/guile/0401-Narrow-parameter-of-logand-immediate-if-no-bits-used.patch
Jeremy Drake b3b5d81c2a guile: backport commits to fix 32-bit
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=71891 says the issue was
fixed in aff9ac968840e9c86719fb613bd2ed3c39b9905c, but to avoid
conflicts (which I don't know how to resolve, not knowing scheme), also
pull in 5e6288c9304b60f1875a44808ee3858e3d6efc83
0dab58fc2a6ac6a8354439749d598f8c24f57ddd and
e45b70dcded37eb77e71ec30445b12040b6bb1b7.
2025-01-08 21:35:15 +01:00

41 lines
1.8 KiB
Diff

From 5e6288c9304b60f1875a44808ee3858e3d6efc83 Mon Sep 17 00:00:00 2001
From: Andy Wingo <wingo@pobox.com>
Date: Mon, 23 Sep 2024 15:57:23 +0200
Subject: [PATCH] Narrow parameter of logand/immediate if no bits used
* module/language/cps/specialize-numbers.scm (specialize-operations):
Narrow ulogand/immediate param according to used bits.
---
module/language/cps/specialize-numbers.scm | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/module/language/cps/specialize-numbers.scm b/module/language/cps/specialize-numbers.scm
index 4ec88871c..f93250756 100644
--- a/module/language/cps/specialize-numbers.scm
+++ b/module/language/cps/specialize-numbers.scm
@@ -1,6 +1,6 @@
;;; Continuation-passing style (CPS) intermediate language (IL)
-;; Copyright (C) 2015-2021, 2023 Free Software Foundation, Inc.
+;; Copyright (C) 2015-2021,2023-2024 Free Software Foundation, Inc.
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -561,9 +561,11 @@ BITS indicating the significant bits needed for a variable. BITS may be
(specialize-unop cps k src op param a
(unbox-u64 a) (box-u64 result))))
- (('logand/immediate (? u64-result? ) param (? u64-operand? a))
+ (('logand/immediate (? u64-result?) param (? u64-operand? a))
(specialize-unop cps k src 'ulogand/immediate
- (logand param (1- (ash 1 64)))
+ (logand param
+ (or (intmap-ref sigbits result) -1)
+ (1- (ash 1 64)))
a
(unbox-u64 a) (box-u64 result)))
--
2.34.1