unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 50268@debbugs.gnu.org
Cc: mwd@md5i.com, "Mattias Engdegård" <mattiase@acm.org>,
	monnier@iro.umontreal.ca, "Andrea Corallo" <akrl@sdf.org>
Subject: bug#50268: 28.0.50; Assertion warning during native compilation
Date: Tue, 21 Sep 2021 13:17:18 +0100	[thread overview]
Message-ID: <878rzqktrl.fsf@tcd.ie> (raw)
In-Reply-To: <xjfczp2s6yc.fsf@ma.sdf.org> (Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors"'s message of "Tue, 21 Sep 2021 07:50:35 +0000")

Andrea Corallo [2021-09-21 07:50 +0000] wrote:

> Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <bug-gnu-emacs@gnu.org> writes:
>
>> Michael Welsh Duggan <mwd@md5i.com> writes:
>>
>>> I was able to determine that there was a bug in the pacproxy.el code
>>> that I included in the bug report.  Fixing that bug caused native
>>> compilation to work.  The assertion and backtrace were not particularly
>>> useful in determining the bug in the code, though.  The bug was in the
>>> `pacproxy--retrieve-wpad' function when I let-bound the following
>>> illegal lambda:
>>>
>>>   (lambda (&rest) "DIRECT")
>>>
>>> The fix was to change this to:
>>>
>>>   (lambda (&rest _) "DIRECT")
>>>
>>> Is there another part of the compiler that could have caught this and
>>> returned a useful diagnostic?
>>
>> Hi Michael & all,
>>
>> I had a quick look and these are my findings:
>>
>> (byte-compile '(lambda (&rest _) "DIRECT"))
>> =>
>> #[128 "\300\207" ["DIRECT"] 2 "DIRECT
>>
>> (fn &rest _)"]
>>
>> Here we have as encoded signature 128 (one rest arg) and the frame size
>> is 2 (one for the rest arg and one for the immediate). Fine...
>>
>> (byte-compile '(lambda () "DIRECT"))
>> =>
>> #[0 "\300\207" ["DIRECT"] 1 "DIRECT"] 
>>
>> Here we have as encoded signature 0 (no args) and the frame size is 1
>> (will be used by the immediate).  Fine as well.
>>
>> (byte-compile '(lambda (&rest) "DIRECT"))
>> =>
>> #[128 "\300\207" ["DIRECT"] 1 "DIRECT
>>
>> (fn &rest)"]
>>
>> This is the problematic case that was signaled as reproducer.  Here we
>> have as encoded signature 128 (one rest arg) but the frame size (1) is
>> not accounting for this.
>>
>> I think this output is a incoherent and I guess the byte compiler should
>> probably just raise an error and refuse to compile if the lambda list is
>> invalid.  Am I wrong?
>
> I can't verify in this moment but I guess is very possible we even
> overflow in the byte interpreter when executing the mentioned bytecode.

In the meantime I think Mattias ran into the same problem in the
following threads:

https://lists.gnu.org/r/emacs-devel/2021-09/msg01492.html
https://bugs.gnu.org/50720

Thanks,

-- 
Basil





  reply	other threads:[~2021-09-21 12:17 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30 14:05 bug#50268: 28.0.50; Assertion warning during native compilation Michael Welsh Duggan
2021-09-04 14:00 ` Michael Welsh Duggan
2021-09-05 15:31   ` Michael Welsh Duggan
2021-09-20 22:12     ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21  7:50       ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-21 12:17         ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2021-09-21 15:56           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  -- strict thread matches above, loose matches on Subject: below --
2021-09-21 11:15 bug#50720: unnamed &rest broken Mattias Engdegård
2021-09-21 16:11 ` bug#50720: bug#50268: 28.0.50; Assertion warning during native compilation Lars Ingebrigtsen
2021-09-21 16:22   ` Mattias Engdegård
2021-09-21 17:09     ` Noam Postavsky
2021-09-21 17:53       ` Eli Zaretskii
2021-09-21 19:32         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-22  5:43           ` Eli Zaretskii
2021-09-23  1:46             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-09-23  6:38               ` Eli Zaretskii
2021-09-23 11:09               ` Mattias Engdegård
2021-09-23 21:03                 ` Lars Ingebrigtsen
2021-09-24  6:07                   ` Eli Zaretskii
2021-09-25  0:51                     ` Lars Ingebrigtsen
2021-09-25 18:37                     ` Mattias Engdegård
2021-09-21 16:26   ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rzqktrl.fsf@tcd.ie \
    --to=bug-gnu-emacs@gnu.org \
    --cc=50268@debbugs.gnu.org \
    --cc=akrl@sdf.org \
    --cc=contovob@tcd.ie \
    --cc=mattiase@acm.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=mwd@md5i.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).