GNU bug report logs -
#76573
30.1; native compilation fails for record inside function
Previous Next
Reported by: Lin Jian <me <at> linj.tech>
Date: Tue, 25 Feb 2025 23:29:02 UTC
Severity: normal
Found in version 30.1
Done: Andrea Corallo <acorallo <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Ping! Andrea, any comments or suggestions, given what Stefan writes?
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: Eli Zaretskii <eliz <at> gnu.org>, me <at> linj.tech, 76573 <at> debbugs.gnu.org,
> misohena <at> gmail.com
> Date: Mon, 12 May 2025 10:19:17 -0400
>
> >> Ping! Any further ideas for how to make progress with this issue?
> > Compiler-wise I'm okay to demote the error to a warning (with the
> > proposed patch).
>
> FWIW, I think `comp.el` should definitely not signal an error here.
> This part of the compiler's code is trying to optimize the code, and
> optimizations should never signal errors: if the code was accepted by
> the byte-compiler, then it's valid and the native compiler should accept
> it as well.
>
> If you want to emit a warning, that's fine but the wording should
> clarify that this is an issue of lack of info potentially relevant for
> an optimization (like when we warn about defsubst defined after they've
> already been called). In the current instance, I wonder if the impact
> of this lack of info (on the quality of the generated code) is
> sufficiently important to warrant a warning.
>
> > Language-wise I asking myself, why should the user create records
> > manually if we have facilities like cl-defstruct?
>
> Why not? Maybe they're using their own alternative to
> `cl-defstruct/defclass`?
>
> BTW, even using `defclass` your code will still signal the same error:
>
> % src/emacs -Q batch --eval '(progn (defclass my-foo () ((a :initarg :a))) (native-compile (defun my-fun () (record `my-foo 3))))'
>
> Error: error (my-fun "Type my-foo missing from typeof-types!")
> signal(error (my-fun "Type my-foo missing from typeof-types!"))
> comp--native-compile(my-fun nil nil)
> native-compile(my-fun)
> (progn (defclass my-foo nil ((a :initarg :a))) (native-compile (defun my-fun nil (record `my-foo 3))))
> eval((progn (defclass my-foo nil ((a :initarg :a))) (native-compile (defun my-fun nil (record `my-foo 3)))) t)
> command-line-1(("--eval" "(progn (defclass my-foo () ((a :initarg :a))) (native-compile (defun my-fun () (record `my-foo 3))))"))
> command-line()
> normal-top-level()
>
> debug-early-backtrace...done
> peculiar error: "Type my-foo missing from typeof-types!"
> %
>
>
> - Stefan
>
>
This bug report was last modified 2 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.