#20: Modular arith bug? ---------------------+------------------------------------------------------ Reporter: rtoy | Owner: somebody Type: defect | Status: new Priority: major | Milestone: Component: Core | Version: 19e Resolution: | Keywords: ---------------------+------------------------------------------------------ Comment (by rtoy):
The issue is partly caused by ldb and, perhaps, partly by ash modular function optimizer.
(ldb (byte size posn) x) is source-transformed to (%ldb size posn x), which has a deftransform that converts it to (logand (ash x (- posn)) (ash (1- (ash 1 vm:word-bits)) (- size vm:word-bits)).
This expression must confuse logand-defopt-helper. One workaround is to change the %ldb to produce simpler expressions when posn and size are known constants.