jscl icon indicating copy to clipboard operation
jscl copied to clipboard

All too

Open vlad-km opened this issue 5 years ago • 2 comments

SBCL

CL-USER> (let ((ii 0) xx yy)
(values (ash (progn (setf xx (incf ii)) 1)
             (progn (setf yy (incf ii)) 2))
        ii xx yy))
4
2
1
2

JSCL

CL-USER> (let ((ii 0) xx yy) 
... (values (ash (progn (setf xx (incf ii)) 1) 
...              (progn (setf yy (incf ii)) 2)) 
...         ii xx yy)) 
... 
4
3
2
3

Workaround:

CL-USER> (defun %ash (x y) (ash x y))
%ASH
CL-USER> (let ((ii 0) xx yy) 
... (values (%ash (progn (setf xx (incf ii)) 1) 
...              (progn (setf yy (incf ii)) 2)) 
...         ii xx yy)) 
... 
4
2
1
2

vlad-km avatar Nov 25 '20 15:11 vlad-km

Looks like the code generator again is not using the right operator precedence? That would explain why the function call works but the inlined primitive fails.

davazp avatar Nov 25 '20 16:11 davazp

In the table, the priorities for operations are set according to ... The problem appears when compilation of the progn block is mixed into any local variable of the ash macro. Intuitively I can say that this is a problem with the progn

vlad-km avatar Nov 25 '20 16:11 vlad-km