GNU bug report logs - #44968
28.0.50; [feature/native-comp] Emacs segfault in `rustic-flycheck-dirs-list'

Previous Next

Package: emacs;

Reported by: Andrea Corallo <akrl <at> sdf.org>

Date: Mon, 30 Nov 2020 19:57:02 UTC

Severity: normal

Found in version 28.0.50

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 44968 in the body.
You can then email your comments to 44968 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#44968; Package emacs. (Mon, 30 Nov 2020 19:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrea Corallo <akrl <at> sdf.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 30 Nov 2020 19:57:02 GMT) Full text and rfc822 format available.

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

From: Andrea Corallo <akrl <at> sdf.org>
To: bug-gnu-emacs <at> gnu.org
Cc: Gerry Agbobada <gerry <at> gagbo.net>
Subject: 28.0.50; [feature/native-comp] Emacs segfault in
 `rustic-flycheck-dirs-list'
Date: Mon, 30 Nov 2020 19:56:09 +0000
Reported by Gerry Agbobada,

reproducer:

============
;; -*- lexical-binding: t -*-

(defun rustic-flycheck-dirs-list (start end)
  "Return a list of directories from START (inclusive) to END (exclusive).
E.g., if START is '/a/b/c/d' and END is '/a', return the list
'(/a/b/c/d /a/b/c /a/b) in this order.
START and END are strings representing file paths.  END should be
above START in the file hierarchy; if not, the list stops at the
root of the file hierarchy."
  (let ((dirlist)
        (dir (expand-file-name start))
        (end (expand-file-name end)))
    (while (not (or (equal dir (car dirlist)) ; avoid infinite loop
                    (file-equal-p dir end)))
      (push dir dirlist)
      (setq dir (directory-file-name (file-name-directory dir))))
    (nreverse dirlist)))

(native-compile #'rustic-flycheck-dirs-list)

(message "%s" (rustic-flycheck-dirs-list "/tmp/test/foo" "/tmp"))

===========





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44968; Package emacs. (Mon, 30 Nov 2020 23:20:02 GMT) Full text and rfc822 format available.

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

From: Andrea Corallo <akrl <at> sdf.org>
To: Gerry Agbobada <gerry <at> gagbo.net>
Cc: 44968 <at> debbugs.gnu.org
Subject: Re: bug#44968: 28.0.50; [feature/native-comp] Emacs segfault in
 `rustic-flycheck-dirs-list'
Date: Mon, 30 Nov 2020 23:19:55 +0000
Hi Gerry,

21104e6808 fix this for me.

Would you like to give it a try and confirm?

Thanks!

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44968; Package emacs. (Mon, 30 Nov 2020 23:41:01 GMT) Full text and rfc822 format available.

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

From: "Gerry Agbobada" <gerry <at> gagbo.net>
To: "Andrea Corallo" <akrl <at> sdf.org>
Cc: 44968 <at> debbugs.gnu.org
Subject: Re: bug#44968: 28.0.50;
  [feature/native-comp] Emacs segfault in `rustic-flycheck-dirs-list'
Date: Tue, 01 Dec 2020 00:37:37 +0100
[Message part 1 (text/plain, inline)]
On Tue, Dec 1, 2020, at 00:19, Andrea Corallo wrote:
> 
> 21104e6808 fix this for me.
> 
> Would you like to give it a try and confirm?
> 
Hi Andrea,

I’ll try, although I must admit that I’ve been using Andrew’s build recipe, so it might take me longer to build from source again to check.

Thanks for the help, I’ll look at the commit to see if I understand something :)

Gerry 
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44968; Package emacs. (Tue, 01 Dec 2020 09:15:02 GMT) Full text and rfc822 format available.

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

From: Andrea Corallo <akrl <at> sdf.org>
To: "Gerry Agbobada" <gerry <at> gagbo.net>
Cc: 44968 <at> debbugs.gnu.org
Subject: Re: bug#44968: 28.0.50; [feature/native-comp] Emacs segfault in
 `rustic-flycheck-dirs-list'
Date: Tue, 01 Dec 2020 09:14:35 +0000
"Gerry Agbobada" <gerry <at> gagbo.net> writes:

> Thanks for the help, I’ll look at the commit to see if I understand something :)

Dumping Limple (setf comp-verbose 3) we can see how the call to `car'
as:

(call car #s(comp-mvar (cons) (nil) nil 15178090 6))

(cons) is the typeset slot of the mvar, (nil) is the valset.
This implies the the mvar may be during execution *or* a cons *or*
assume value nil.

Hence the fix to `comp-mvar-cons-p' in the commit.

Without this `comp-mvar-cons-p' was returning t and the backend was
erroneously generating code on this false assumption.  Indeed at the
first iteration of your reproducer the argument of car is nil and not a
cons, and so the crash.

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#44968; Package emacs. (Tue, 01 Dec 2020 11:10:02 GMT) Full text and rfc822 format available.

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

From: "Gerry Agbobada" <gerry <at> gagbo.net>
To: "Andrea Corallo" <akrl <at> sdf.org>
Cc: 44968 <at> debbugs.gnu.org
Subject: Re: bug#44968: 28.0.50;
  [feature/native-comp] Emacs segfault in `rustic-flycheck-dirs-list'
Date: Tue, 01 Dec 2020 12:07:17 +0100
[Message part 1 (text/plain, inline)]
On Tue, Dec 1, 2020, at 10:14, Andrea Corallo wrote:
> (call car #s(comp-mvar (cons) (nil) nil 15178090 6))
> 

Hello,

I see, thanks for the explanation and the quick fix :) (I tested today and the commit works well)

Have a good day,

Gerry
[Message part 2 (text/html, inline)]

Reply sent to Andrea Corallo <akrl <at> sdf.org>:
You have taken responsibility. (Tue, 01 Dec 2020 13:17:02 GMT) Full text and rfc822 format available.

Notification sent to Andrea Corallo <akrl <at> sdf.org>:
bug acknowledged by developer. (Tue, 01 Dec 2020 13:17:02 GMT) Full text and rfc822 format available.

Message #22 received at 44968-done <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: "Gerry Agbobada" <gerry <at> gagbo.net>
Cc: 44968-done <at> debbugs.gnu.org
Subject: Re: bug#44968: 28.0.50; [feature/native-comp] Emacs segfault in
 `rustic-flycheck-dirs-list'
Date: Tue, 01 Dec 2020 13:16:10 +0000
"Gerry Agbobada" <gerry <at> gagbo.net> writes:

> On Tue, Dec 1, 2020, at 10:14, Andrea Corallo wrote:
>
>  (call car #s(comp-mvar (cons) (nil) nil 15178090 6))
>
> Hello,
>
> I see, thanks for the explanation and the quick fix :) (I tested today and the commit works well)

Thanks for checking, closing then.

Andrea




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 30 Dec 2020 12:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 167 days ago.

Previous Next


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