GNU bug report logs - #31549
25.3; bytecompile fails with eval-when-compile

Previous Next

Package: emacs;

Reported by: ynyaaa <at> gmail.com

Date: Tue, 22 May 2018 09:02:01 UTC

Severity: minor

Found in version 25.3

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 31549 <at> debbugs.gnu.org (full text, mbox):

From: Noam Postavsky <npostavs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: ynyaaa <at> gmail.com, 31549 <at> debbugs.gnu.org
Subject: Re: bug#31549: 25.3; bytecompile fails with eval-when-compile
Date: Wed, 23 May 2018 18:34:06 -0400
fixed 31549 26.1
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

>> The error is coming from exec_byte_code:
>> 
>>   if (MAX_ALLOCA / word_size <= XFASTINT (maxdepth))
>>     memory_full (SIZE_MAX);
>
> You mean, in expansion of SAFE_ALLOCA_LISP_EXTRA?

Oh, sorry, I missed that the code has been changed quite a bit in Emacs
26.  I said:

    I can't reproduce in Emacs 26, but only because MAX_ALLOCA is
    bigger, I think.

But v26 exec_byte_code will allocate with malloc if needed, so the bug
is fixed (and MAX_ALLOCA is the same size).

> How about simply signaling a special error instead of memory_full?
> Something like
>
>   error ("Lisp stack overflow");

Still might be worth considering changing the error, although stack
overflow doesn't describe it correctly anymore.  As far as I can tell,
SAFE_ALLOCA_LISP_EXTRA will only signal memory_full if the number of
bytes to allocate won't fit in a ptrdiff_t variable.  That should be
pretty much impossible, barring some strange bugs.  So maybe:

--- i/src/lisp.h
+++ w/src/lisp.h
@@ -4662,7 +4662,7 @@ egetenv (const char *var)
     if (INT_MULTIPLY_WRAPV (nelt, word_size, &alloca_nbytes)   \
 	|| INT_ADD_WRAPV (alloca_nbytes, extra, &alloca_nbytes) \
 	|| SIZE_MAX < alloca_nbytes)			       \
-      memory_full (SIZE_MAX);				       \
+      error ("Oversize allocation (0x%lX)", (size_t) alloca_nbytes);    \
     else if (alloca_nbytes <= sa_avail)			       \
       (buf) = AVAIL_ALLOCA (alloca_nbytes);		       \
     else						       \




This bug report was last modified 6 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.