armedbear / abcl

Armed Bear Common Lisp <git+https://github.com/armedbear/abcl/> <--> <svn+https://abcl.org/svn> Bridge
https://abcl.org#rdfs:seeAlso<https://gitlab.common-lisp.net/abcl/abcl>
Other
291 stars 29 forks source link

ABCL is inlining where it shouldn't #377

Open mdbergmann opened 3 years ago

mdbergmann commented 3 years ago

This came up because cl-murmurhash couldn't be compiled on ABCL.

https://github.com/ruricolist/cl-murmurhash/issues/10

@ruricolist said: "This appears to be an ABCL bug (it's inlining a local function in a global function of the same name that's declared inline). I've pushed up a workaround."

ruricolist commented 3 years ago

Here's a reduced example. Put this in a file and compile it, and you get a stack overflow.

(in-package :cl-user)

(declaim (inline fn))

(defun fn (x)
  (flet ((fn (x) (1+ x)))
    (declare (dynamic-extent #'fn))
    (fn x)))

(print (fn 1))

If you omit the dynamic-extent declaration you get a different error:

#<THREAD "interpreter" {246D2EC1}>: Debugger invoked on condition of type ERROR
  Caught java.lang.ClassCastException: class org.armedbear.lisp.Cons cannot be cast to class org.armedbear.lisp.LispThread$StackMarker (org.armedbear.lisp.Cons and org.armedbear.lisp.LispThread$StackMarker are in unnamed module of loader 'app').
easye commented 3 years ago

Previous problems with inline declarations https://abcl.org/trac/ticket/353. In general, this code could use some rethought.