Subject: bug#46847: closed (Re: bug#46847: 28.0.50; [native-comp] assume pseudo-insns should be verified)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 20 Mar 2024 09:34:02 +0000

Your bug report

#46847: 28.0.50; [native-comp] assume pseudo-insns should be verified

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
46847: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=46847
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#46847: 28.0.50; [native-comp] assume pseudo-insns should be verified
From: Andrea Corallo <[email-masked]>
To: Andrea Corallo <[email-masked]>
Cc: [email-masked], Pip Cet <[email-masked]>
Date: Wed, 20 Mar 2024 05:30:04 -0400
List-Id: <debbugs-submit.debbugs.gnu.org>

I'm closing this old bug as with 0b0c7da8c80 I've installed a sanitizer
that instruments the code in order to check that compile time value
predictions of mvars are respected at runtime.  Mvars verified are all
mvars being tested by conditional branches, this to verify the correct
CFG/execution of the program.

Enabling sanitizer instrumentation and runtime verification I'm able to
bootstrap the compiler and run all the compiler testsuite.

We might extend this further in the future but I think for now is okay.

Thanks

  Andrea

Subject: 28.0.50; [native-comp] assume pseudo-insns should be verified
From: Pip Cet <[email-masked]>
To: [email-masked]
Date: Mon, 1 Mar 2021 13:06:31 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

This is a wishlist item for the native-comp branch, though I consider
the feature in question to be so essential that its absence also
qualifies as a bug.

The native-comp branch is emitting assume pseudo-insns. Those come in
various forms, but their interpretation is clear: they express
conditions which are meant to hold at runtime, and which the compiler
may use to optimize code.

I would like to add an optional compiler pass which asserts that the
conditions are actually true at runtime. This is a basic safeguard
that any assume() mechanism should have, and it's perfectly equivalent
to the way eassume() becomes eassert() in debug builds of Emacs.

Unfortunately, it turns out that while adding the compiler pass is
easy, there are many failures because the assume pseudo-insns emitted
at present are inconsistent or plain wrong. Some of these wrong
assumes result in reproducible Lisp-to-native-code bugs today; others
will not; for still others, we're not sure.

For example, the four following bugs became a problem only because of
a lack of this safeguard: bug#46843 (both bugs), bug#46812, bug#46670.

Merging native-comp without such a safeguard would, I am convinced,
introduce preventable, tricky, unnecessary bugs into the Emacs master
branch.  We shouldn't do that.

Pip