Subject: Re: bug#69249: bug in native-compile?

From: Robert Boyer <[email-masked]>
Date: Sun, 18 Feb 2024 14:14:27 -0600

> am I right?

Nope.

As my message points out, those declare forms are certainly accepted when
Emacs interprets them and when byte-compile sees them.  Furthermore, such
declare forms are necessary for life as we know it in the free world, so
that fixnum arithmetic can be used where appropriate!

Bob

On Sun, Feb 18, 2024 at 1:44 PM Eli Zaretskii <[email-masked]> wrote:

> > Cc: [email-masked]
> > From: Robert Boyer <[email-masked]>
> > Date: Sat, 17 Feb 2024 22:26:27 -0600
> >
> > Here is a report on what seems to me to be a bug in native-compile.
> >
> > ----------------------------------------------------------------------
> >
> > ;; Let us suppose that this is the file "compile-bug.el"
> >
> > ;; Invoking (native-compile "compile-bug.el") should work, I do believe.
> > ;; However it fails and the error message is printed below.
> >
> > ;; It cannot be emphasized enough how serious this problem seems to me,
> Bob
> > ;; Boyer, [email-masked].
> >
> > ;; The reason it is so SERIOUS is that ANY Lisp compiler would need to be
> > ;; delighted to see such a typing expression as
> >
> > ;;   (declare (fixnum start end) (vector input scratch))
> >
> > ;; Why? BECAUSE it means that the compiler does not have to lay down
> code to
> > ;; type check the type of start, end, input, and scratch!!!!
> >
> > ;; However, (native-compile "compile-bug.el") results in the following
> error message:
> >
> > ;; Compiling file
> /mnt/chromeos/GoogleDrive/MyDrive/Linux/working/compile-bug.el at Fri Feb
> 16 08:25:19
> > 2024
> > ;; compile-bug.el:2:45: Warning: Unknown defun property ‘fixnum’ in foo
> > ;; compile-bug.el:2:45: Warning: Unknown defun property ‘vector’ in foo
> >
> > (defun foo (start end input scratch)
> >   (declare (fixnum start end) (vector input scratch))
> >   (list start end input scratch))
> >
> > ;; foo works fine
> >
> > ;; Here is an example form for the invocation of foo:
> >
> > ;; (foo 1 2 (make-vector 3 4) (make-vector 5 6))
> >
> > ;; That form runs ok if it is running with foo interpreted.
> >
> > ;; (byte-compile 'foo) runs ok.
> >
> > ;; One can run the same form after byte-compiling and it runs ok.
> >
> > ;; However, (native-compile "compile-bug.el") fails with
> > ;; the error report:
> >
> > ;; Compiling file
> /mnt/chromeos/GoogleDrive/MyDrive/Linux/working/compile-bug.el at Fri Feb
> 16 08:35:04
> > 2024
> > ;; compile-bug.el:12:45: Warning: Unknown defun property ‘fixnum’ in foo
> > ;; compile-bug.el:12:45: Warning: Unknown defun property ‘vector’ in foo
>
> Where did you see these declare forms documented?  I don't see them in
> the ELisp Reference manual.  I think you copied them from some other
> Lisp.  In which case Emacs is correct telling you that these declare
> forms are unknown.
>
> Andrea, Stefan: am I right?
>

-- 
Anything I seem to state should be taken as a question.  I am at least 77
and feeble.