Subject: Re: bug#76180: [feature/igc] Remaining known tracing issues

From: Pip Cet <[email-masked]>
Date: Tue, 11 Feb 2025 20:27:23 +0000

Pip Cet <[email-masked]> writes:

> diff --git a/src/lread.c b/src/lread.c
> index e8cd689d794..67c1bbe5f7b 100644
> --- a/src/lread.c
> +++ b/src/lread.c
> @@ -3483,6 +3483,11 @@ bytecode_from_rev_list (Lisp_Object elems, Lisp_Object readcharfun)
>  	            || NILP (vec[CLOSURE_CONSTANTS]))))))
>      invalid_syntax ("Invalid byte-code object", readcharfun);
>  
> +#ifdef HAVE_MPS
> +  if (XFIXNAT (vec[CLOSURE_STACK_DEPTH]) >= 1022)
> +    error ("Byte-code object uses too much stack, increase HORRIBLE_ESTIMATE!");
> +#endif
> +
>    if (STRINGP (vec[CLOSURE_CODE]))
>      {
>        if (STRING_MULTIBYTE (vec[CLOSURE_CODE]))
> -- 
> 2.48.1

Sorry, this hunk wasn't the one I meant to send.  This one needs to be
applied after it:

diff --git a/src/lread.c b/src/lread.c
index a638b6eec8e..ae312874574 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3576,7 +3576,7 @@ bytecode_from_rev_list (Lisp_Object elems, Lisp_Object readcharfun)
     invalid_syntax ("Invalid byte-code object", readcharfun);
 
 #ifdef HAVE_MPS
-  if (XFIXNAT (vec[CLOSURE_STACK_DEPTH]) >= 1022)
+  if (size > CLOSURE_STACK_DEPTH && XFIXNAT (vec[CLOSURE_STACK_DEPTH]) >= 1022)
     error ("Byte-code object uses too much stack, increase HORRIBLE_ESTIMATE!");
 #endif

to fix the obvious problem :-)