Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LET doesn't bind specials in parallel (again) #1481

Open
g000001 opened this issue Aug 12, 2023 · 1 comment
Open

LET doesn't bind specials in parallel (again) #1481

g000001 opened this issue Aug 12, 2023 · 1 comment
Labels

Comments

@g000001
Copy link

g000001 commented Aug 12, 2023

Describe the bug

Same issue as #69

STAK from famous gabriel benchmarks:

;;; STAK -- The TAKeuchi function with special variables instead of parameter
;;; passing.

(defvar *stak-x*)
(defvar *stak-y*)
(defvar *stak-z*)

(defun stak-aux ()
  (if (not (< (the fixnum *stak-y*) (the fixnum *stak-x*)))
      *stak-z*
      (let ((*stak-x* (let ((*stak-x* (the fixnum (1- (the fixnum *stak-x*))))
                            (*stak-y* *stak-y*)
                            (*stak-z* *stak-z*))
                        (stak-aux)))
	    (*stak-y* (let ((*stak-x* (the fixnum (1- (the fixnum *stak-y*))))
                            (*stak-y* *stak-z*)
                            (*stak-z* *stak-x*))
                        (stak-aux)))
	    (*stak-z* (let ((*stak-x* (the fixnum (1- (the fixnum *stak-z*))))
                            (*stak-y* *stak-x*)
                            (*stak-z* *stak-y*))
                        (stak-aux))))
	(stak-aux))))

(defun stak (*stak-x* *stak-y* *stak-z*)
  (stak-aux))


(lisp-implementation-type)
→ "clasp"

(lisp-implementation-version)
→ "cclasp-boehmprecise-2.3.0-120-gbbe2d9d57-cst"

;;; `stak-aux` decriments special variable infinitely...
(stak 18 12 6) >>>  illegal hardware instruction

Expected behavior

(stak 18 12 6) → 7

cf. lambda binds special variable in parallel properly.

(defun stak-aux ()
  (if (not (< (the fixnum *stak-y*) (the fixnum *stak-x*)))
      *stak-z*
      ((lambda (*stak-x* *stak-y* *stak-z*)
         (stak-aux))
       ((lambda (*stak-x* *stak-y* *stak-z*)
          (stak-aux))
        (the fixnum (1- (the fixnum *stak-x*)))
        *stak-y*
        *stak-z*)
       ((lambda (*stak-x* *stak-y* *stak-z*)
          (stak-aux))
        (the fixnum (1- (the fixnum *stak-y*)))
        *stak-z*
        *stak-x*)
       ((lambda (*stak-x* *stak-y* *stak-z*)
          (stak-aux))
        (the fixnum (1- (the fixnum *stak-z*)))
        *stak-x*
        *stak-y*))))

(defun stak (*stak-x* *stak-y* *stak-z*)
  (stak-aux))

(stak 18 12 6) → 7
@g000001 g000001 added the bug label Aug 12, 2023
@Bike
Copy link
Member

Bike commented Sep 28, 2023

No idea how this broke in clasp-cleavir but the bytecode problem is at least fairly obvious. I'll also put in a test so we catch this earlier next time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants