unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#50720: unnamed &rest broken
@ 2021-09-21 11:15 Mattias Engdegård
  2021-09-21 16:11 ` bug#50720: bug#50268: 28.0.50; Assertion warning during native compilation Lars Ingebrigtsen
  0 siblings, 1 reply; 22+ messages in thread
From: Mattias Engdegård @ 2021-09-21 11:15 UTC (permalink / raw)
  To: 50720

The interpreter and compiler allow &rest to be used without a variable name following but the generated byte code is completely broken:

(funcall (byte-compile (lambda (&rest) 'ta)))

crashes, and

(defun boo (a &rest)
  (if a a (list 1 2 3 4)))

(boo 'hiss)
=> hiss        ; interpreted
=> (1 2 3 4)   ; compiled

The reason is that the compiler generates code from the argument variable list but the byte-code interpreter will only look at the signature code which was generated from the actual signature:

(byte-compile (lambda (&rest) 'ta))
=> #[128 "\300\207" [ta] 1 "..."]

The 128 indicates zero positional parameters and a &rest argument, and the 1 is the maximum stack size required which is wrong; 2 stack slots are needed and that's what we get if naming the argument:

(byte-compile (lambda (&rest _r) 'ta))
=> #[128 "\300\207" [ta] 2 "..."]

In the `boo` case above, it is clear that the compiler doesn't expect any &rest param to have been pushed at all so the stack offsets are wrong.

Now, either we fix this bug or we stop pretending that unnamed &rest arguments work at all and signal an error, because it's clear from the above that they can't have seen much use.






^ permalink raw reply	[flat|nested] 22+ messages in thread
* bug#50268: 28.0.50; Assertion warning during native compilation
@ 2021-08-30 14:05 Michael Welsh Duggan
  2021-09-04 14:00 ` Michael Welsh Duggan
  0 siblings, 1 reply; 22+ messages in thread
From: Michael Welsh Duggan @ 2021-08-30 14:05 UTC (permalink / raw)
  To: 50268

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]


With the included file in the current working directory...

First, byte compile the file:
    emacs -Q -batch --eval '(byte-compile-file "pacproxy.el")'

Then, from 
    emacs -Q

    M-: (push default-directory load-path) RET
    M-x load-library RET pacproxy RET

For me, this results in the following warning:

    Warning (comp): /home/md5i/tmp/tmp/pacproxy.el: Error: Assertion failed (and (< idx (comp-vec-end vec)) (>= idx (comp-vec-beg vec)))


[-- Attachment #2: pacproxy.el --]
[-- Type: application/emacs-lisp, Size: 2855 bytes --]

[-- Attachment #3: Type: text/plain, Size: 5363 bytes --]


In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0)
 of 2021-08-30 built on miko
Repository revision: bc9516a6f12d21971db62ad5def51a3b4858a488
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid
 --with-native-compilation'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NATIVE_COMP
NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND THREADS TIFF X11 XAW3D
XDBE XIM XPM LUCID ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  flyspell-mode: t
  display-time-mode: t
  magit-wip-initial-backup-mode: t
  magit-wip-before-change-mode: t
  magit-wip-after-apply-mode: t
  magit-wip-after-save-mode: t
  magit-wip-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/cmake-mode hides /home/md5i/.config/emacs/elpa/cmake-mode-20210104.1831/cmake-mode
/home/md5i/.config/emacs/elpa/transient-20210311.1549/transient hides /usr/local/share/emacs/28.0.50/lisp/transient

Features:
(shadow sort mail-extr gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime
smime dig gnus-sum shr kinsoku svg gnus-group gnus-undo gnus-start
gnus-dbus gnus-cloud gnus-spec gnus-win emacsbug sendmail flyspell
ispell view pacproxy dbus xml descr-text cus-edit pp cus-load time
sieve-manage sasl sasl-anonymous sasl-login sasl-plain rng-loc rng-uri
rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util sgml-mode facemenu dom python tramp-sh tramp
tramp-loaddefs trampver tramp-integration files-x tramp-compat
parse-time iso8601 ls-lisp ps-print ps-print-loaddefs ps-def lpr picture
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log magit-diff smerge-mode
diff git-commit log-edit pcvs-util add-log magit-core magit-autorevert
autorevert filenotify magit-margin magit-transient magit-process
with-editor shell pcomplete server magit-mode transient format-spec
magit-git magit-section comp comp-cstr warnings rx cl-extra help-mode
benchmark magit-utils pcase which-func imenu vc-git diff-mode easy-mmode
vc-dispatcher ido crm dash nnimap nnmail gnus-int gnus-range mail-source
message rfc822 mml mml-sec epa mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader utf7 netrc nnoo gnus wid-edit nnheader gnus-util
rmail rmail-loaddefs time-date mail-utils gnus-o365-oauth2 oauth2
url-http url-auth mail-parse rfc2231 rfc2047 rfc2045 mm-util ietf-drums
mail-prsvr url-gw nsm rmc puny plstore generated generic-x epg rfc6068
epg-config ediff ediff-merg ediff-mult ediff-wind ediff-diff ediff-help
ediff-init ediff-util dired-x dired dired-loaddefs compile
text-property-search comint ring ansi-color cc-mode cc-fonts cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs edmacro
kmacro derived debian-el finder-inf info package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache json subr-x map
url-vars seq byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib
iso-transl tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo x-toolkit x multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 472475 15472)
 (symbols 48 29207 0)
 (strings 32 96154 4379)
 (string-bytes 1 3212668)
 (vectors 16 46522)
 (vector-slots 8 809008 15265)
 (floats 8 664 82)
 (intervals 56 418 14)
 (buffers 992 14))

-- 
Michael Welsh Duggan
(md5i@md5i.com)

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-09-25 18:37 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
  -- strict thread matches above, loose matches on Subject: below --
2021-08-30 14:05 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
2021-09-21 15:56           ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors

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).