Fix bug in unsigned modular arithmetic using a signed implementation
authorChristophe Rhodes <csr21@cantab.net>
Thu, 5 Apr 2012 18:55:05 +0000 (19:55 +0100)
committerChristophe Rhodes <csr21@cantab.net>
Fri, 13 Apr 2012 16:31:03 +0000 (17:31 +0100)
commit52b1041d3a14eaa4e45f6d8edfbdc0dec4292239
tree5cae23e6c690e6d87412912180444d3198b52bd8
parent3d46727f4b73a63c788c143efb1f196c153af371
Fix bug in unsigned modular arithmetic using a signed implementation

If we aim to be clever by implementing an unsigned modular arithmetic
computation using signed arithmetic, we need to make sure that we
don't accidentally contaminate the computation with any extraneous
high bits.  This means that we must be sure to cut constants to the
appropriate width, as well as computations, so do so; this fixes
bug #974406 from Paul Dietz.  (In addition the change from cutting
to the requested width to the implementation width fixes #903821,
so Go Team!)

Test cases.  Minimally horrible test case for #903821; far worse
suggestions were made on #sbcl IRC...
NEWS
src/compiler/srctran.lisp
tests/compiler.impure.lisp
tests/compiler.pure.lisp