Skip to content

Commit

Permalink
avoid infinite loop causing crash on CCL
Browse files Browse the repository at this point in the history
cbaggers#239
infinite loop stack overflow crash

This fix from Devon7
cbaggers/cepl#350 (comment)

Issue explained in
Clozure/ccl#270 (comment)

CLHS NOTINLINE says,

In the presence of a compiler macro definition for function-name,
a notinline declaration prevents that compiler macro from being used.

The macroexpansion machinery contained in the fn library ignores this fact
and recursively compiler-macroexpands the INTERN form which was explicitly
declared NOTINLINE, which leads into infinite loops as demonstrated here.
  • Loading branch information
Yan committed Dec 21, 2020
1 parent 800dfa5 commit cc1c09f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/vari.glsl/variables-from-spec.lisp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
(in-package :vari.glsl)
(in-readtable fn:fn-reader)

(eval-when (:compile-toplevel :load-toplevel :execute)
(defvar *definitions-missing-from-glsl-spec*
Expand All @@ -9,14 +8,15 @@
)))

(defmacro populate-vars ()
(let ((vars (mapcar λ(destructuring-bind
(let ((vars (mapcar (lambda (_)
(destructuring-bind
(&key lisp-name name type place-p versions
(stage t) &allow-other-keys) _
(declare (ignore versions))
(assert lisp-name)
(let* ((lisp-name (intern lisp-name :vari.glsl))
(lisp-type (parse-gl-type-name type)))
`(,stage ,lisp-name ,name ,lisp-type ,place-p)))
`(,stage ,lisp-name ,name ,lisp-type ,place-p))))
(append *definitions-missing-from-glsl-spec*
glsl-spec:*variables*))))

Expand All @@ -25,7 +25,7 @@
',(mapcar (lambda (stage-name stage-type-name)
(cons stage-type-name
(mapcar #'rest (remove-if-not
λ(eq stage-name _)
(lambda (_) (eq stage-name _))
vars :key #'first))))
(cons t *stage-names*)
(cons t *stage-type-names*)))
Expand Down

0 comments on commit cc1c09f

Please sign in to comment.