diff --git a/bin/run-ansi-tests.sh b/bin/run-ansi-tests.sh index d9d0be8f140291af8120d496d04166fbd5c2c332..6b9b14777c0f122b090926977db71fbc5c00dc69 100755 --- a/bin/run-ansi-tests.sh +++ b/bin/run-ansi-tests.sh @@ -41,7 +41,7 @@ else fi cd ../ansi-test -git checkout cmucl-expected-failures +git checkout issue-288-new-failures make LISP="$LISP batch -noinit -nositeinit" # There should be no unexpected successes or failures; check these separately diff --git a/src/compiler/float-tran.lisp b/src/compiler/float-tran.lisp index f4d4843e00bbc041b94bbf5927e7aa41aca4333b..250a2b128c89352660c8bea1ae8a3e6f48778838 100644 --- a/src/compiler/float-tran.lisp +++ b/src/compiler/float-tran.lisp @@ -236,7 +236,7 @@ (frob %random-single-float single-float) (frob %random-double-float double-float)) -#-(or new-random random-mt19937 rand-xoroshiro) +#-(or new-random random-mt19937 random-xoroshiro) (deftransform random ((num &optional state) ((integer 1 #.random-fixnum-max) &optional *)) _N"use inline fixnum operations" @@ -259,7 +259,7 @@ '(values (truncate (%random-double-float (coerce num 'double-float) (or state *random-state*))))) -#+(or random-mt19937) +#+(or random-mt19937 random-xoroshiro) (deftransform random ((num &optional state) ((integer 1 #.(expt 2 32)) &optional *)) _N"use inline (unsigned-byte 32) operations" diff --git a/src/i18n/locale/cmucl.pot b/src/i18n/locale/cmucl.pot index c8be36983e2e71e9e32f8cc7ee251ab656cfa589..e0131e0ebdac63f10e151e25ea297d9f2e857684 100644 --- a/src/i18n/locale/cmucl.pot +++ b/src/i18n/locale/cmucl.pot @@ -19001,6 +19001,10 @@ msgstr "" msgid "use inline (unsigned-byte 32) operations" msgstr "" +#: src/compiler/float-tran.lisp +msgid "Shouldn't happen" +msgstr "" + #: src/compiler/float-tran.lisp msgid "Can't open-code float to rational comparison." msgstr "" diff --git a/tests/rng.lisp b/tests/rng.lisp index 00e9557cf9d5d19ef971e716c4c67c73938f2621..caa7ea9c178c00b947044e636d5dfb46187a4a18 100644 --- a/tests/rng.lisp +++ b/tests/rng.lisp @@ -82,3 +82,27 @@ (assert-equal result (multiple-value-list (64-bit-rng-state *test-state*))))) +;; Test that the deftransform for random integers is working. +(defun rng-int-trans (state) + (declare (type random-state state) + (optimize (speed 3))) + (random 100000 state)) + +(defun rng-int (n state) + (declare (type random-state state)) + (random n state)) + +(define-test deftransform-random-int + (:tag :issues) + ;; Using the same state, generate a random integer with RNG-INT. + ;; This is the expected value. The generate an integer with + ;; RNG-INT-TRANS. The compiler should have used a deftransform in + ;; this function. The values returned should be the same. + (let ((state (kernel::make-random-object :state (kernel::init-random-state 31415926535)))) + (dotimes (k 2) + (print state) + (assert-equal (rng-int 100000 (make-random-state state)) + (rng-int-trans (make-random-state state))) + ;; Generate a random number to change our state. + (random 100000 state)))) +