* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
@ 2024-09-15 8:27 Iurie Marian
2024-09-16 17:21 ` Andrea Corallo
0 siblings, 1 reply; 7+ messages in thread
From: Iurie Marian @ 2024-09-15 8:27 UTC (permalink / raw)
To: 73270, acorallo
[-- Attachment #1: Type: text/plain, Size: 6004 bytes --]
Dear Emacs maintainers,
I encountered an issue with latest Emacs' master branch. I am using a
package `pcre2el'
and I noticed a wrong behavior after updating Emacs. I tracked the change
which causes the
issue, and it seems it's the below commit:
#+begin_comment
a1775552cef5a8bc0ba13e802ecf343423a53364
Author: Andrea Corallo <akrl@sdf.org>
AuthorDate: Tue May 23 11:18:07 2023 +0200
Commit: Andrea Corallo <acorallo@gnu.org>
CommitDate: Thu Jul 11 16:26:49 2024 +0200
#+end_comment
probably the newly introduced `comp--type-check-optim' is causing the issue.
Issue description:
* `pcre2el''s rxt-adt->strings execution expectation
#+begin_comment
ELISP> (rxt-adt->strings (rxt-parse-pcre (rxt--add-flags "t([es]{2})" nil)))
("tss" "tse" "tes" "tee")
#+end_comment
* The error
#+begin_comment
ELISP> (rxt-adt->strings (rxt-parse-pcre (rxt--add-flags "t([es]{4})" nil)))
*** Eval error *** Wrong type argument: listp, #s(rxt-repeat 4 4
#s(rxt-char-set-union (115 101) nil nil nil) t)
#+end_comment
That's how the above function [[
https://github.com/joddie/pcre2el/blob/b4d846d80dddb313042131cf2b8fbf647567e000/pcre2el.el#L2984C1-L3004C46][rxt-adt->strings]]
looks like:
#+begin_src emacs-lisp
(defun rxt-adt->strings (re)
(cl-typecase re
(rxt-primitive
(list ""))
(rxt-string
(list (rxt-string-chars re)))
(rxt-seq
(rxt-seq-elts->strings (rxt-seq-elts re)))
(rxt-choice
(rxt-choice-elts->strings (rxt-choice-elts re)))
(rxt-submatch
(rxt-adt->strings (rxt-submatch-body re)))
(rxt-submatch-numbered
(rxt-adt->strings (rxt-submatch-numbered-body re)))
(rxt-repeat
(rxt-repeat->strings re))
(rxt-char-set-union
(rxt-char-set->strings re))
(t
(error "Can't generate productions of %s"
(rxt-syntax-tree-readable re)))))
#+end_src
The issue comes from
#+begin_comment
(cl-typecase re
#+end_comment
instead of matching below:
#+begin_comment
(rxt-submatch
(rxt-adt->strings (rxt-submatch-body re)))
#+end_comment
it wrongly matches:
#+begin_comment
(rxt-seq
(rxt-seq-elts->strings (rxt-seq-elts re)))
#+end_comment
and throws the error
#+begin_comment
ELISP> (rxt-adt->strings (rxt-parse-pcre (rxt--add-flags "t([es]{4})" nil)))
*** Eval error *** Wrong type argument: listp, #s(rxt-repeat 4 4
#s(rxt-char-set-union (115 101) nil nil nil) t)
#+end_comment
To quickly check this I've added some traces:
#+begin_src emacs-lisp
(defun rxt-adt->strings (re)
(message "type-of re: %S, re = %S" (type-of re) re)
(cl-typecase re
(rxt-primitive
(progn (message "match: rxt-primitive")
(list "")))
(rxt-string
(progn (message "match: rxt-string")
(list (rxt-string-chars re))))
(rxt-seq
(progn (message "match: rxt-seq")
(rxt-seq-elts->strings (rxt-seq-elts re))))
(rxt-choice
(progn (message "match: rxt-choice")
(rxt-choice-elts->strings (rxt-choice-elts re))))
(rxt-submatch
(progn (message "match: rxt-submatch")
(rxt-adt->strings (rxt-submatch-body re))))
(rxt-submatch-numbered
(progn (message "match: rxt-submatch-numbered")
(rxt-adt->strings (rxt-submatch-numbered-body re))))
(rxt-repeat
(progn (message "match: rxt-repeat")
(rxt-repeat->strings re)))
(rxt-char-set-union
(progn (message "match: rxt-char-set-union")
(rxt-char-set->strings re)))
(t
(error "Can't generate productions of %s"
(rxt-syntax-tree-readable re)))))
#+end_src
which produces below messages:
#+begin_comment
type-of re: rxt-seq, re = #s(rxt-seq (#s(rxt-string "t" nil)
#s(rxt-submatch #s(rxt-repeat 4 4 #s(rxt-char-set-union (115 101) nil nil
nil) t))))
match: rxt-seq
type-of re: rxt-string, re = #s(rxt-string "t" nil)
match: rxt-string
type-of re: rxt-submatch, re = #s(rxt-submatch #s(rxt-repeat 4 4
#s(rxt-char-set-union (115 101) nil nil nil) t))
match: rxt-seq
#+end_comment
By commenting line (`comp--type-check-optim') in `comp-passes' (see below),
it fixes locally the issue, which makes me think that this is the culprit.
#+begin_src emacs-lisp
(defconst comp-passes '(comp--spill-lap
comp--limplify
comp--fwprop
comp--call-optim
comp--ipa-pure
comp--add-cstrs
comp--fwprop
;; comp--type-check-optim
comp--tco
comp--fwprop
comp--remove-type-hints
comp--sanitizer
comp--compute-function-types
comp--final)
"Passes to be executed in order.")
#+end_src
Kind Regards,
Iurie
In GNU Emacs 31.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version
3.24.41, cairo version 1.18.0) of 2024-09-13 built on rrouwprlc0222
Repository revision: 7376623a244a91d1de5245645b4b3e8c9469d422
Repository branch: master
System Description: Ubuntu 24.04.1 LTS
Configured using:
'configure 'CFLAGS= -O3 -fallow-store-data-races
-fno-semantic-interposition -flto -fuse-ld=gold' LD=/usr/bin/ld.gold
--prefix=/tools/emacs/build --sysconfdir=/etc
--libexecdir=/tools/emacs/build/usr/lib
--localstatedir=/tools/emacs/build/var --with-modules
--without-gconf --without-gsettings --enable-link-time-optimization
--with-x-toolkit=yes --without-xaw3d --without-m17n-flt --with-cairo
--with-xwidgets --without-compress-install
--with-native-compilation=aot --with-mailutils --with-xft --with-rsvg
--with-pgtk'
Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS HARFBUZZ JPEG LIBOTF LIBSELINUX
LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP
SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM
XWIDGETS GTK3 ZLIB
Important settings:
value of $LC_ALL: C
value of $LANG: en_US.UTF-8
value of $XMODIFIERS: @im=ibus
locale-coding-system: utf-8
[-- Attachment #2: Type: text/html, Size: 7498 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-09-15 8:27 bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues Iurie Marian
@ 2024-09-16 17:21 ` Andrea Corallo
2024-10-15 8:35 ` Andrea Corallo
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Corallo @ 2024-09-16 17:21 UTC (permalink / raw)
To: Iurie Marian; +Cc: 73270
Thanks Iurie,
I'll try to look at this this week.
Andrea
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-09-16 17:21 ` Andrea Corallo
@ 2024-10-15 8:35 ` Andrea Corallo
2024-10-15 20:22 ` Andrea Corallo
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Corallo @ 2024-10-15 8:35 UTC (permalink / raw)
To: Iurie Marian; +Cc: 73270
Here is my minimal reproducer so far:
test.el===============
;; -*- lexical-binding: t; -*-
(require 'cl-lib)
(cl-defstruct base)
(cl-defstruct
(child1 (:include base)))
(cl-defstruct
(child2 (:include base)))
(cl-defstruct
(child3 (:include base)))
(cl-defstruct
(child4 (:include base)))
(defun foo (x)
(message "type-of x: %S, x = %S" (type-of x) x)
(cl-typecase x
(child1
(message "match: child1"))
(child2
(message "match: child2"))
(child3
(message "match: child3"))
(child4
(message "match: child4"))))
=============
(progn
(load (native-compile "test.el"))
(foo (make-child4)))
evaluates to : "match: child3"
I'm looking into it.
Andrea
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-10-15 8:35 ` Andrea Corallo
@ 2024-10-15 20:22 ` Andrea Corallo
2024-10-15 20:29 ` Andrea Corallo
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Corallo @ 2024-10-15 20:22 UTC (permalink / raw)
To: Iurie Marian; +Cc: 73270
Hi Iurie,
with cd739d3644b in master I believe this should be fixed. Would you
verifying and reporting?
Thanks!
Andrea
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-10-15 20:22 ` Andrea Corallo
@ 2024-10-15 20:29 ` Andrea Corallo
2024-10-18 17:52 ` Iurie Marian
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Corallo @ 2024-10-15 20:29 UTC (permalink / raw)
To: Iurie Marian; +Cc: 73270
Andrea Corallo <acorallo@gnu.org> writes:
> Hi Iurie,
>
> with cd739d3644b in master I believe this should be fixed. Would you
> verifying and reporting?
^^
like
Andrea
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-10-15 20:29 ` Andrea Corallo
@ 2024-10-18 17:52 ` Iurie Marian
2024-10-21 15:44 ` Andrea Corallo
0 siblings, 1 reply; 7+ messages in thread
From: Iurie Marian @ 2024-10-18 17:52 UTC (permalink / raw)
To: Andrea Corallo; +Cc: 73270
[-- Attachment #1: Type: text/plain, Size: 394 bytes --]
Hello Andrea,
Yes! I can confirm that it has been fixed. :)
Many thanks for your effort and great work!
Kind Regards,
Iurie
On Tue, 15 Oct 2024 at 22:29, Andrea Corallo <acorallo@gnu.org> wrote:
> Andrea Corallo <acorallo@gnu.org> writes:
>
> > Hi Iurie,
> >
> > with cd739d3644b in master I believe this should be fixed. Would you
> > verifying and reporting?
> ^^
> like
>
> Andrea
>
[-- Attachment #2: Type: text/html, Size: 843 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues
2024-10-18 17:52 ` Iurie Marian
@ 2024-10-21 15:44 ` Andrea Corallo
0 siblings, 0 replies; 7+ messages in thread
From: Andrea Corallo @ 2024-10-21 15:44 UTC (permalink / raw)
To: Iurie Marian; +Cc: 73270-done
Iurie Marian <marian.iurie@gmail.com> writes:
> Hello Andrea,
>
> Yes! I can confirm that it has been fixed. :)
> Many thanks for your effort and great work!
>
> Kind Regards,
> Iurie
Thank you for the precise report 👍 closing
Andrea
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-10-21 15:44 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-15 8:27 bug#73270: 31.0.50; comp.el comp--type-check-optim pass causes issues Iurie Marian
2024-09-16 17:21 ` Andrea Corallo
2024-10-15 8:35 ` Andrea Corallo
2024-10-15 20:22 ` Andrea Corallo
2024-10-15 20:29 ` Andrea Corallo
2024-10-18 17:52 ` Iurie Marian
2024-10-21 15:44 ` Andrea Corallo
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.