>>>> "Gunnar" == Gunnar Evermann
<ge204(a)eng.cam.ac.uk> writes:
Gunnar> dhawkins(a)rmas.com writes:
> M-x doctor
Gunnar> [snip]
> bash$ Fatal error: assertion failed, file bytecode.c, line 532,
specpdl_ptr->func == 0
Gunnar> I can reproduce that and have investigated a little bit. I have a
Gunnar> pretty good idea what is causing it, but am too afraid to touch the
Gunnar> marzilla stuff. :-)
Gunnar> first of all a smaller recipe for the crash:
Gunnar> - create a file test.el containing: (defun foo (bar) bar)
Gunnar> - byte-compile and load this file
Gunnar> - in *scratch* eval: (foo 7)
Gunnar> OK, '7' is printed
Gunnar> - make bar buffer-local: (make-local-variable 'bar)
Gunnar> - eval (foo 7) again
Gunnar> CRASH
Gunnar> The problem is that funcall_compiled_function() correctly creates the
Gunnar> specbinding for the local variable bar:
Gunnar> $27 = {symbol = 139220936,
Gunnar> old_value = 138893388,
Gunnar> func = 0x80bdbec <specbind_unwind_local>}
Gunnar> but at eval.c:532 UNBIND_TO_GCPRO_VARIABLES_ONLY is used which assumes
Gunnar> that all bindings are 'normal' variables (i.e. func==0).
Gunnar> I'm pretty sure that all this can be cured by using UNBIND_TO_GCPRO
Gunnar> instead but maybe there is a smarter way. Martin?
Thanks, Gunnar. I think your analysis is excellent. I don't see
offhand how to keep the UNBIND_TO_GCPRO_VARIABLES_ONLY optimization,
and see nothing better than to use UNBIND_TO_GCPRO. My logic error
was thinking that func was only used for unwind-protects and such things.
This is kind of annoying. We have to give up this optimization for
the case of magic variables being used as function arguments, which
*almost* never happens, and is probably never actually useful.
Martin