X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Fcompiler.pure.lisp;h=fe4bd644e7d1e1625b58b71b56e3da65908c479c;hb=52b1041d3a14eaa4e45f6d8edfbdc0dec4292239;hp=bcdfe32e7b50e5d215bbc2b6802e343b55f061cd;hpb=3d46727f4b73a63c788c143efb1f196c153af371;p=sbcl.git diff --git a/tests/compiler.pure.lisp b/tests/compiler.pure.lisp index bcdfe32..fe4bd64 100644 --- a/tests/compiler.pure.lisp +++ b/tests/compiler.pure.lisp @@ -4209,3 +4209,30 @@ :c)))) (style-warning () :style-warning))))) + +(with-test (:name :bug-974406) + (let ((fun32 (compile nil `(lambda (x) + (declare (optimize speed (safety 0))) + (declare (type (integer 53 86) x)) + (logand (+ x 1032791128) 11007078467)))) + (fun64 (compile nil `(lambda (x) + (declare (optimize speed (safety 0))) + (declare (type (integer 53 86) x)) + (logand (+ x 1152921504606846975) + 38046409652025950207))))) + (assert (= (funcall fun32 61) 268574721)) + (assert (= (funcall fun64 61) 60))) + (let (result) + (do ((width 5 (1+ width))) + ((= width 130)) + (dotimes (extra 4) + (let ((fun (compile nil `(lambda (x) + (declare (optimize speed (safety 0))) + (declare (type (integer 1 16) x)) + (logand + (+ x ,(1- (ash 1 width))) + ,(logior (ash 1 (+ width 1 extra)) + (1- (ash 1 width)))))))) + (unless (= (funcall fun 16) (logand 15 (1- (ash 1 width)))) + (push (cons width extra) result))))) + (assert (null result))))