master: Defensively code in type-width-in-bits

snuglas via Sbcl-commits <[email protected]>
Newsgroups gmane.lisp.steel-bank.cvs
Message-ID <[email protected]>
The branch "master" has been updated in SBCL:
       via  566883ab44ee474bfa5b12a00e8b6aeb2d946fdb (commit)
      from  c9317d951a80eab801e3a93e4edb346dc54fa302 (commit)

- Log -----------------------------------------------------------------
commit 566883ab44ee474bfa5b12a00e8b6aeb2d946fdb
Author: Douglas Katzman <[email protected]>
Date:   Sun Apr 19 11:59:56 2026 -0400

    Defensively code in type-width-in-bits
    
    The receiving logic already potentially expected NIL
---
 src/compiler/generic/utils.lisp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/compiler/generic/utils.lisp b/src/compiler/generic/utils.lisp
index 85e6f5533..cdff56dab 100644
--- a/src/compiler/generic/utils.lisp
+++ b/src/compiler/generic/utils.lisp
@@ -593,7 +593,8 @@
   ;; Return (integer-length upper-bound) of numeric type. This is NOT a theoretical
   ;; smallest N bits needed to encode an element of type in a packed representation
   ;; (e.g. the interval 5..8 _could_ be stored in 2 bits) but we don't do that.
-  (integer-length (sb-c::interval-high (sb-c::numeric-type->interval ctype))))
+  (if (typep ctype 'numeric-union-type)
+      (integer-length (sb-c::interval-high (sb-c::numeric-type->interval ctype)))))
 
 (defun env-system-tlab-p (env)
   #-system-tlabs (declare (ignore env))

-----------------------------------------------------------------------


hooks/post-receive
-- 
SBCL
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.