Re: Bug in type derivation in ASH

Stas Boukarev <[email protected]>
Newsgroups gmane.lisp.steel-bank.devel
Message-ID <CAF63=12Uea+B0nzvEv2A2i4iCux=EFgFu0R9bWLd7Gp32zM5Eg@mail.gmail.com>
Fixed. Thanks.

On Sun, Jan 18, 2026 at 6:19 PM Eric Marsden via Sbcl-devel
<[email protected]> wrote:
>
> Hi,
>
>  From random-integer testing on AMD64.
>
> * (lisp-implementation-version)
> "2.6.0.99-2a51c9781"
> * (defun foo (a)
>      (declare (type (integer -2 17422209769261795) a))
>      (* 80244663406399 (1- (ash -27 (min 29 (count a '(42)))))))
>
> ; in: DEFUN FOO
> ;     (* 80244663406399 (1- (ASH -27 (MIN 29 (COUNT A '#)))))
> ;
> ; caught WARNING:
> ;   Derived type of
> ;   (- (ASH -27 (MIN 29 (COUNT COMMON-LISP-USER::A (QUOTE (42))))) 1) is
> ;     (VALUES
> ;      (INTEGER -347717124281138701405307355253
> -173858562140569390824985380826)
> ;      &OPTIONAL),
> ;
> ;   conflicting with its asserted type
> ;     (INTEGER -4413456487351945 -2246850575379172).
> ;   See also:
> ;     The SBCL Manual, Node "Handling of Types"
> ;
> ; compilation unit finished
> ;   caught 1 WARNING condition
> FOO
> * (foo 42)
>
> debugger invoked on a SIMPLE-TYPE-ERROR in thread
> #<THREAD tid=99180 "main thread" RUNNING {1200BF0003}>:
>    Value of (- (ASH -27 (MIN 29 (COUNT A '#))) 1) in
>    SB-C::X
>    is
>      -347717124281138701405307355253,
>    not a
>      (INTEGER -4413456487351945 -2246850575379172).
>
> Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
>
>
> _______________________________________________
> Sbcl-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sbcl-devel


_______________________________________________
Sbcl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sbcl-devel
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.