abcl icon indicating copy to clipboard operation
abcl copied to clipboard

Order of evaluation in expression with BOOLE in compiled code <http://abcl.org/trac/ticket/455>

Open pfdietz opened this issue 8 years ago • 2 comments

(eval '(let ((a 15)) (boole boole-2 (logior 0 (setf a 14)) a))) ==> 14

(eval (funcall (compile nil '(lambda () (let ((a 15)) (boole boole-2 (logior 0 (setf a 14)) a)))))) ==> 15

pfdietz avatar Oct 03 '17 22:10 pfdietz

Not order of evaluation, the (setf a 14) effect is left out because of some bogus short-circuiting in p2-logior - removing the case in lines 4444-4447 fixes this (for example, that might not be a good way to fix it).

Ferada avatar Nov 18 '17 23:11 Ferada

To follow up on that, something like https://github.com/Ferada/abcl/commit/b73738abdfdc310fa67f7ae7c95572746df7d592 would solve this while being a tiny bit worse since what could be done is forcing the compilation of the side effects while also returning the already calculated result as well (discarding the return value of the side effect).

Ferada avatar Nov 20 '17 17:11 Ferada