Subject: Re: bug#46670: 28.0.50; [feature/native-comp] possible miscompilation affecting lsp-mode

From: Pip Cet <[email-masked]>
Date: Tue, 23 Feb 2021 19:09:11 +0000

On Mon, Feb 22, 2021 at 1:12 PM Andrea Corallo <[email-masked]> wrote:
> We'll probably see other bugs in this area cause is tricky, is important
> we build the best coverage we can for this in the testsuite.

Is this one of them, or am I confused?
From 9ab3a1e8196cce10eab50903302af1cc24580595 Mon Sep 17 00:00:00 2001
From: Pip Cet <[email-masked]>
Date: Tue, 23 Feb 2021 19:05:53 +0000
Subject: [PATCH] Don't emit incorrect assumptions for non-equality (Bug#46770)

* lisp/emacs-lisp/comp.el (comp-add-cond-cstrs): Don't assume the
lhs and rhs coincide for a negated 'and constraint.
---
 lisp/emacs-lisp/comp.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
index 60c040926e54c..847c5c424aaa8 100644
--- a/lisp/emacs-lisp/comp.el
+++ b/lisp/emacs-lisp/comp.el
@@ -2255,8 +2255,8 @@ comp-emit-assume
       ('and
        (if (comp-mvar-p rhs)
            (let ((tmp-mvar (if negated
-                               (make-comp-mvar :slot (comp-mvar-slot rhs))
-                             rhs)))
+                               (make-comp-mvar :slot (comp-mvar-slot lhs))
+                             lhs)))
              (push `(assume ,(make-comp-mvar :slot lhs-slot)
                             (and ,lhs ,tmp-mvar))
 	           (comp-block-insns bb))
-- 
2.30.0