Subject: [feature/native-comp] miscompilation(?) of functions with non local exits
From: Andrea Corallo <[email-masked]>
To: [email-masked]
Cc: Eli Zaretskii <[email-masked]>, Stefan Monnier <[email-masked]>
Date: Wed, 15 Jul 2020 08:24:00 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Due to a recent modification native-comp is (probably?) miscompiling
lexical scope functions with non local exits if they involve code with
side effect on local variables.  Before fixing I prefer to double check
the correct behavior we want.

Considering the following piece of (lexical scoped) code:

===
(let (x)
  (ignore-errors
    (setq x t)
    (error "foo"))
  x)
===

Three options:

  1- Because setq is evaluated the expression should always evaluate to
  t.

  2- Unwinding the original state of the stack is restored, when it was
  saved 'x' was nil so the expression should evaluate to nil.

  3- This is unspecified.

The current stock implementaion does always 1 so I'm prone to just go
for it but I wanted to double check to be on the safe side.

FYI 1 implies C register variables cannot be used to implement Lisp
local variable if non local exits are present.

Thanks

  Andrea

--
[email-masked]