summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorGemini Lasswell <gazally@runbox.com>2018-10-14 12:12:04 -0700
committerGemini Lasswell <gazally@runbox.com>2018-10-29 11:05:00 -0700
commit0e484c66fd63877230c3dfa97f2ce9dda71ad88b (patch)
treea7cf3670fdd67ce433329744c4e73f3b9214cd39 /src/eval.c
parentb9c60200259a562f4762e8debf4646319d7a9332 (diff)
downloademacs-0e484c66fd63877230c3dfa97f2ce9dda71ad88b.tar.gz
Keep a stack reference to bytecode objects being executed (Bug#33014)
* src/eval.c (Ffuncall): Make local variable 'fun' volatile. * test/src/eval-tests.el (eval-tests-byte-code-being-evaluated-is-protected-from-gc): Add regression test for Bug#33014. (eval-tests-33014-var): New variable. (eval-tests-33014-func, eval-tests-33014-redefine): New functions.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index a51d0c90831..32cfda24d8c 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -2820,8 +2820,11 @@ Thus, (funcall \\='cons \\='x \\='y) returns (x . y).
usage: (funcall FUNCTION &rest ARGUMENTS) */)
(ptrdiff_t nargs, Lisp_Object *args)
{
- Lisp_Object fun, original_fun;
- Lisp_Object funcar;
+ /* Use 'volatile' here to cause optimizing compilers to keep a
+ reference on the stack to the function's bytecode object. See
+ Bug#33014. */
+ Lisp_Object volatile fun;
+ Lisp_Object original_fun, funcar;
ptrdiff_t numargs = nargs - 1;
Lisp_Object val;
ptrdiff_t count;