unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#69249: bug in native-compile?
@ 2024-02-18  4:26 Robert Boyer
  2024-02-18 19:44 ` Eli Zaretskii
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-18  4:26 UTC (permalink / raw)
  To: 69249; +Cc: rms

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

Dear Emacs bug fixers,

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, robertstephenboyer@gmail.com.

;; 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

;; Let us suppose that this is the end of the file "compile-bug.el"
----------------------------------------------------------------------

Here is the rest of the info that I think that m-x report-emacs-bug was
trying
to enclose in my failed attempt to use m-x report-emacs-bug.


Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/28.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/28.2/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-mPr7Vr/emacs-28.2+1=.
 -fstack-protector-strong -Wformat -Werror=format-security -Wall'
 'CPPFLAGS=-Wdate-time -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL 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
TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: ELisp/d

Minor modes in effect:
  shell-dirtrack-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util rmail rmail-loaddefs mm-decode
mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader
sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils
mode-local autorevert filenotify descr-text eieio-opt speedbar ezimage
dframe shortdoc lpr apropos compile text-property-search comp comp-cstr
warnings rx cl-extra cl-print debug backtrace find-func help-fns
radix-tree help-mode thingatpt misearch multi-isearch time-date
cus-start etags fileloop generator xref project dired-aux cus-edit pp
cus-load wid-edit trace sh-script smie executable dired dired-loaddefs
cal-menu calendar cal-loaddefs ange-ftp shell pcomplete comint
ansi-color ring benchmark time face-remap finder-inf 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 paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode 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 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 emoji-zwj 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 move-toolbar gtk x-toolkit x multi-tty make-network-process
native-compile emacs)

Memory information:
((conses 16 440800 29368)
 (symbols 48 15229 0)
 (strings 32 57747 2517)
 (string-bytes 1 4555170)
 (vectors 16 31666)
 (vector-slots 8 931977 74485)
 (floats 8 118 370)
 (intervals 56 88945 28)
 (buffers 992 36))

ReplyForward
Add reaction

[-- Attachment #2: Type: text/html, Size: 18426 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18  4:26 bug#69249: bug in native-compile? Robert Boyer
@ 2024-02-18 19:44 ` Eli Zaretskii
  2024-02-18 20:14   ` Robert Boyer
  2024-02-19  7:48   ` Andrea Corallo
  2024-02-18 22:45 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-18 23:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 2 replies; 18+ messages in thread
From: Eli Zaretskii @ 2024-02-18 19:44 UTC (permalink / raw)
  To: Robert Boyer, Andrea Corallo, Stefan Monnier; +Cc: 69249, rms

> Cc: rms@gnu.org
> From: Robert Boyer <robertstephenboyer@gmail.com>
> 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, robertstephenboyer@gmail.com.
> 
> ;; 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?





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

* bug#69249: bug in native-compile?
  2024-02-18 19:44 ` Eli Zaretskii
@ 2024-02-18 20:14   ` Robert Boyer
  2024-02-18 21:28     ` Andreas Schwab
  2024-02-19  7:48   ` Andrea Corallo
  1 sibling, 1 reply; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 20:14 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69249, Andrea Corallo, Stefan Monnier, rms

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

> 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 <eliz@gnu.org> wrote:

> > Cc: rms@gnu.org
> > From: Robert Boyer <robertstephenboyer@gmail.com>
> > 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, robertstephenboyer@gmail.com.
> >
> > ;; 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.

[-- Attachment #2: Type: text/html, Size: 4022 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 20:14   ` Robert Boyer
@ 2024-02-18 21:28     ` Andreas Schwab
  2024-02-18 22:19       ` Robert Boyer
  0 siblings, 1 reply; 18+ messages in thread
From: Andreas Schwab @ 2024-02-18 21:28 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, Eli Zaretskii, Andrea Corallo, Stefan Monnier, rms

On Feb 18 2024, Robert Boyer wrote:

> 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!

If you are programming in Emacs Lisp, you need to follow the rules of
Emacs Lisp.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."





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

* bug#69249: bug in native-compile?
  2024-02-18 21:28     ` Andreas Schwab
@ 2024-02-18 22:19       ` Robert Boyer
  2024-02-18 22:25         ` Robert Boyer
  2024-02-19  3:30         ` Eli Zaretskii
  0 siblings, 2 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 22:19 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 69249, Eli Zaretskii, Andrea Corallo, Stefan Monnier, rms

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

This message is about how important DECLARE and THE are.  If you do not
handle DECLARE and THE right, people will laugh at native-compile.

Here is an SBCL transcript.  I am running on a $100 Lenovo Chromebook.

I got SBCL with the command sudo apt-get install sbcl.

* (declaim (optimize (safety 0) (speed 3) (debug 0)))
NIL
* (defun foo-with-declare (n)
  (let ((i 0)
        (sum 0)
        (max (expt 10 n)))
    (declare (fixnum i sum max))
    (loop (cond ((<= i max)
                 (setq sum (the fixnum (+ sum i))))
                (t (return sum)))
          (incf i))))
FOO-WITH-DECLARE
* (time (foo-with-declare 8))
Evaluation took:
  0.125 seconds of real time
  0.123203 seconds of total run time (0.123193 user, 0.000010 system)
  98.40% CPU
  135,905,516 processor cycles
  0 bytes consed
5000000050000000
* (defun foo-without-declare (n)
  (let ((i 0)
        (sum 0)
        (max (expt 10 n)))
    (loop (cond ((<= i max)
                 (setq sum (+ sum i)))
                (t (return sum)))
          (incf i))))
WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN
FOO-WITHOUT-DECLARE
* (time (foo-without-declare 8))
Evaluation took:
  1.080 seconds of real time
  1.072932 seconds of total run time (1.072932 user, 0.000000 system)
  99.35% CPU
  1,181,369,303 processor cycles
  0 bytes consed
5000000050000000

People go wow about 8X.  How does native-compile do?

There is a great song by Alabama 'If you gonna play in Texas, you gotta
have a fiddle in the band'. Check it out!

https://www.youtube.com/watch?v=w6r4E514nJg

Bob


Bob


On Sun, Feb 18, 2024 at 3:28 PM Andreas Schwab <schwab@linux-m68k.org>
wrote:

> On Feb 18 2024, Robert Boyer wrote:
>
> > 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!
>
> If you are programming in Emacs Lisp, you need to follow the rules of
> Emacs Lisp.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>


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

[-- Attachment #2: Type: text/html, Size: 4035 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 22:19       ` Robert Boyer
@ 2024-02-18 22:25         ` Robert Boyer
  2024-02-18 22:39           ` Robert Boyer
  2024-02-19  3:30         ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 22:25 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 69249, Eli Zaretskii, Andrea Corallo, Stefan Monnier, rms

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

And you should know what DECLARE and THE do for AREF.  All the difference
in the world, and I will give you a simple demo if you wish.

Bob

On Sun, Feb 18, 2024 at 4:19 PM Robert Boyer <robertstephenboyer@gmail.com>
wrote:

> This message is about how important DECLARE and THE are.  If you do not
> handle DECLARE and THE right, people will laugh at native-compile.
>
> Here is an SBCL transcript.  I am running on a $100 Lenovo Chromebook.
>
> I got SBCL with the command sudo apt-get install sbcl.
>
> * (declaim (optimize (safety 0) (speed 3) (debug 0)))
> NIL
> * (defun foo-with-declare (n)
>   (let ((i 0)
>         (sum 0)
>         (max (expt 10 n)))
>     (declare (fixnum i sum max))
>     (loop (cond ((<= i max)
>                  (setq sum (the fixnum (+ sum i))))
>                 (t (return sum)))
>           (incf i))))
> FOO-WITH-DECLARE
> * (time (foo-with-declare 8))
> Evaluation took:
>   0.125 seconds of real time
>   0.123203 seconds of total run time (0.123193 user, 0.000010 system)
>   98.40% CPU
>   135,905,516 processor cycles
>   0 bytes consed
> 5000000050000000
> * (defun foo-without-declare (n)
>   (let ((i 0)
>         (sum 0)
>         (max (expt 10 n)))
>     (loop (cond ((<= i max)
>                  (setq sum (+ sum i)))
>                 (t (return sum)))
>           (incf i))))
> WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN
> FOO-WITHOUT-DECLARE
> * (time (foo-without-declare 8))
> Evaluation took:
>   1.080 seconds of real time
>   1.072932 seconds of total run time (1.072932 user, 0.000000 system)
>   99.35% CPU
>   1,181,369,303 processor cycles
>   0 bytes consed
> 5000000050000000
>
> People go wow about 8X.  How does native-compile do?
>
> There is a great song by Alabama 'If you gonna play in Texas, you gotta
> have a fiddle in the band'. Check it out!
>
> https://www.youtube.com/watch?v=w6r4E514nJg
>
> Bob
>
>
> Bob
>
>
> On Sun, Feb 18, 2024 at 3:28 PM Andreas Schwab <schwab@linux-m68k.org>
> wrote:
>
>> On Feb 18 2024, Robert Boyer wrote:
>>
>> > 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!
>>
>> If you are programming in Emacs Lisp, you need to follow the rules of
>> Emacs Lisp.
>>
>> --
>> Andreas Schwab, schwab@linux-m68k.org
>> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
>> "And now for something completely different."
>>
>
>
> --
> Anything I seem to state should be taken as a question.  I am at least 77
> and feeble.
>


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

[-- Attachment #2: Type: text/html, Size: 4809 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 22:25         ` Robert Boyer
@ 2024-02-18 22:39           ` Robert Boyer
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 22:39 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: 69249, Eli Zaretskii, Andrea Corallo, Stefan Monnier, rms

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

Look out, here it comes, as Tracy Schwarz says.

The following DISASSEMBLE might tell you what you need to do for
native-compile.

Speaking with the utmost sincerity, I know less about the following than I
do about what Proust called the greatest painting in the world, the View of
Delft by Vermmer.  Check it out.

https://www.mauritshuis.nl/en/our-collection/artworks/92-view-of-delft/

Again, this is in SBCL on my $100 Lenovo Chromebook.

* (disassemble 'foo-with-declare)
; disassembly for FOO-WITH-DECLARE
; Size: 60 bytes. Origin: #x52A4AF19                          ;
FOO-WITH-DECLARE
; 19:       4883EC10         SUB RSP, 16
; 1D:       BA14000000       MOV EDX, 20
; 22:       B904000000       MOV ECX, 4
; 27:       48892C24         MOV [RSP], RBP
; 2B:       488BEC           MOV RBP, RSP
; 2E:       B842BD3550       MOV EAX, #x5035BD42              ; #<FDEFN
EXPT>
; 33:       FFD0             CALL RAX
; 35:       31C0             XOR EAX, EAX
; 37:       31C9             XOR ECX, ECX
; 39:       EB0C             JMP L1
; 3B:       0F1F440000       NOP
; 40: L0:   4801C1           ADD RCX, RAX
; 43:       4883C002         ADD RAX, 2
; 47: L1:   4839D0           CMP RAX, RDX
; 4A:       7EF4             JLE L0
; 4C:       488BD1           MOV RDX, RCX
; 4F:       488BE5           MOV RSP, RBP
; 52:       F8               CLC
; 53:       5D               POP RBP
; 54:       C3               RET
NIL
*

Bob


On Sun, Feb 18, 2024 at 4:25 PM Robert Boyer <robertstephenboyer@gmail.com>
wrote:

> And you should know what DECLARE and THE do for AREF.  All the difference
> in the world, and I will give you a simple demo if you wish.
>
> Bob
>
> On Sun, Feb 18, 2024 at 4:19 PM Robert Boyer <robertstephenboyer@gmail.com>
> wrote:
>
>> This message is about how important DECLARE and THE are.  If you do not
>> handle DECLARE and THE right, people will laugh at native-compile.
>>
>> Here is an SBCL transcript.  I am running on a $100 Lenovo Chromebook.
>>
>> I got SBCL with the command sudo apt-get install sbcl.
>>
>> * (declaim (optimize (safety 0) (speed 3) (debug 0)))
>> NIL
>> * (defun foo-with-declare (n)
>>   (let ((i 0)
>>         (sum 0)
>>         (max (expt 10 n)))
>>     (declare (fixnum i sum max))
>>     (loop (cond ((<= i max)
>>                  (setq sum (the fixnum (+ sum i))))
>>                 (t (return sum)))
>>           (incf i))))
>> FOO-WITH-DECLARE
>> * (time (foo-with-declare 8))
>> Evaluation took:
>>   0.125 seconds of real time
>>   0.123203 seconds of total run time (0.123193 user, 0.000010 system)
>>   98.40% CPU
>>   135,905,516 processor cycles
>>   0 bytes consed
>> 5000000050000000
>> * (defun foo-without-declare (n)
>>   (let ((i 0)
>>         (sum 0)
>>         (max (expt 10 n)))
>>     (loop (cond ((<= i max)
>>                  (setq sum (+ sum i)))
>>                 (t (return sum)))
>>           (incf i))))
>> WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN
>> FOO-WITHOUT-DECLARE
>> * (time (foo-without-declare 8))
>> Evaluation took:
>>   1.080 seconds of real time
>>   1.072932 seconds of total run time (1.072932 user, 0.000000 system)
>>   99.35% CPU
>>   1,181,369,303 processor cycles
>>   0 bytes consed
>> 5000000050000000
>>
>> People go wow about 8X.  How does native-compile do?
>>
>> There is a great song by Alabama 'If you gonna play in Texas, you gotta
>> have a fiddle in the band'. Check it out!
>>
>> https://www.youtube.com/watch?v=w6r4E514nJg
>>
>> Bob
>>
>>
>> Bob
>>
>>
>> On Sun, Feb 18, 2024 at 3:28 PM Andreas Schwab <schwab@linux-m68k.org>
>> wrote:
>>
>>> On Feb 18 2024, Robert Boyer wrote:
>>>
>>> > 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!
>>>
>>> If you are programming in Emacs Lisp, you need to follow the rules of
>>> Emacs Lisp.
>>>
>>> --
>>> Andreas Schwab, schwab@linux-m68k.org
>>> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
>>> "And now for something completely different."
>>>
>>
>>
>> --
>> Anything I seem to state should be taken as a question.  I am at least 77
>> and feeble.
>>
>
>
> --
> Anything I seem to state should be taken as a question.  I am at least 77
> and feeble.
>


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

[-- Attachment #2: Type: text/html, Size: 8375 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18  4:26 bug#69249: bug in native-compile? Robert Boyer
  2024-02-18 19:44 ` Eli Zaretskii
@ 2024-02-18 22:45 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-18 23:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2 siblings, 0 replies; 18+ messages in thread
From: Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-18 22:45 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, rms

Robert Boyer <robertstephenboyer@gmail.com> writes:

> ;; (byte-compile 'foo) runs ok.

This is only because the function `byte-compile' disables the display of
compiler warnings.

Sorry, but the feature you expect doesn't exist.

Michael.





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

* bug#69249: bug in native-compile?
  2024-02-18  4:26 bug#69249: bug in native-compile? Robert Boyer
  2024-02-18 19:44 ` Eli Zaretskii
  2024-02-18 22:45 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-18 23:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-18 23:42   ` Robert Boyer
  2 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-18 23:32 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, rms

> ;; 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

First thing: these are not error messages!  They're *warnings*!

`batch-byte-compile` also gives those warnings, because ELisp does not
know those declarations.  The native compiler does support some type
annotations, but they do not take this shape.

I presume you took those from some other Lisp dialect, but that won't do
you much good.  Scheme is not Clojure is not Common Lisp is not ELisp ...

BTW, A more recent Emacs would give you an additional warning:

    Warning: file has no ‘lexical-binding’ directive on its first line

So, I see no bug.  Did the resulting native-compile misbehave in
any way?  I presume you're worried about its performance.
If so, do you have concrete code where you measured the performance and
were disappointed and where you have good reasons to believe that type
annotations would make a difference?  If so, we'd be interested to see
your code to try and improve our compiler.


        Stefan






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

* bug#69249: bug in native-compile?
  2024-02-18 23:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-18 23:42   ` Robert Boyer
  2024-02-18 23:46     ` Robert Boyer
  2024-02-19 15:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 23:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 69249, rms

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

 If so, we'd be interested to see your code to try and improve our compiler.

I hope this helps.  If not, please let me know.



Robert Boyer <robertstephenboyer@gmail.com>
4:19 PM (1 hour ago)
Reply to all
to Andreas, Eli, 69249, Andrea, Stefan, rms
This message is about how important DECLARE and THE are.  If you do not
handle DECLARE and THE right, people will laugh at native-compile.

Here is an SBCL transcript.  I am running on a $100 Lenovo Chromebook.

I got SBCL with the command sudo apt-get install sbcl.

* (declaim (optimize (safety 0) (speed 3) (debug 0)))
NIL
* (defun foo-with-declare (n)
  (let ((i 0)
        (sum 0)
        (max (expt 10 n)))
    (declare (fixnum i sum max))
    (loop (cond ((<= i max)
                 (setq sum (the fixnum (+ sum i))))
                (t (return sum)))
          (incf i))))
FOO-WITH-DECLARE
* (time (foo-with-declare 8))
Evaluation took:
  0.125 seconds of real time
  0.123203 seconds of total run time (0.123193 user, 0.000010 system)
  98.40% CPU
  135,905,516 processor cycles
  0 bytes consed
5000000050000000
* (defun foo-without-declare (n)
  (let ((i 0)
        (sum 0)
        (max (expt 10 n)))
    (loop (cond ((<= i max)
                 (setq sum (+ sum i)))
                (t (return sum)))
          (incf i))))
WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN
FOO-WITHOUT-DECLARE
* (time (foo-without-declare 8))
Evaluation took:
  1.080 seconds of real time
  1.072932 seconds of total run time (1.072932 user, 0.000000 system)
  99.35% CPU
  1,181,369,303 processor cycles
  0 bytes consed
5000000050000000

People go wow about 8X.  How does native-compile do?

There is a great song by Alabama 'If you gonna play in Texas, you gotta
have a fiddle in the band'. Check it out!

https://www.youtube.com/watch?v=w6r4E514nJg

Bob


Bob


On Sun, Feb 18, 2024 at 3:28 PM Andreas Schwab <schwab@linux-m68k.org>
wrote:

> On Feb 18 2024, Robert Boyer wrote:
>
> > 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!
>
> If you are programming in Emacs Lisp, you need to follow the rules of
> Emacs Lisp.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
> "And now for something completely different."
>


--
Anything I seem to state should be taken as a question.  I am at least 77
and feeble.
Attachments area
Preview YouTube video If You're Gonna Play In Texas
If You're Gonna Play In Texas
<https://www.youtube.com/watch?v=w6r4E514nJg&authuser=0>
Reply allReplyForward
Add reaction

On Sun, Feb 18, 2024 at 5:32 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > ;; 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
>
> First thing: these are not error messages!  They're *warnings*!
>
> `batch-byte-compile` also gives those warnings, because ELisp does not
> know those declarations.  The native compiler does support some type
> annotations, but they do not take this shape.
>
> I presume you took those from some other Lisp dialect, but that won't do
> you much good.  Scheme is not Clojure is not Common Lisp is not ELisp ...
>
> BTW, A more recent Emacs would give you an additional warning:
>
>     Warning: file has no ‘lexical-binding’ directive on its first line
>
> So, I see no bug.  Did the resulting native-compile misbehave in
> any way?  I presume you're worried about its performance.
> If so, do you have concrete code where you measured the performance and
> were disappointed and where you have good reasons to believe that type
> annotations would make a difference?  If so, we'd be interested to see
> your code to try and improve our compiler.
>
>
>         Stefan
>
>

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

[-- Attachment #2: Type: text/html, Size: 21441 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 23:42   ` Robert Boyer
@ 2024-02-18 23:46     ` Robert Boyer
  2024-02-19 15:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-18 23:46 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 69249, rms

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

Robert Boyer <robertstephenboyer@gmail.com>
4:39 PM (1 hour ago)
Reply to all
to Andreas, Eli, 69249, Andrea, Stefan, rms
Look out, here it comes, as Tracy Schwarz says.

The following DISASSEMBLE might tell you what you need to do for
native-compile.

Speaking with the utmost sincerity, I know less about the following than I
do about what Proust called the greatest painting in the world, the View of
Delft by Vermmer.  Check it out.

https://www.mauritshuis.nl/en/our-collection/artworks/92-view-of-delft/

Again, this is in SBCL on my $100 Lenovo Chromebook.

* (disassemble 'foo-with-declare)
; disassembly for FOO-WITH-DECLARE
; Size: 60 bytes. Origin: #x52A4AF19                          ;
FOO-WITH-DECLARE
; 19:       4883EC10         SUB RSP, 16
; 1D:       BA14000000       MOV EDX, 20
; 22:       B904000000       MOV ECX, 4
; 27:       48892C24         MOV [RSP], RBP
; 2B:       488BEC           MOV RBP, RSP
; 2E:       B842BD3550       MOV EAX, #x5035BD42              ; #<FDEFN
EXPT>
; 33:       FFD0             CALL RAX
; 35:       31C0             XOR EAX, EAX
; 37:       31C9             XOR ECX, ECX
; 39:       EB0C             JMP L1
; 3B:       0F1F440000       NOP
; 40: L0:   4801C1           ADD RCX, RAX
; 43:       4883C002         ADD RAX, 2
; 47: L1:   4839D0           CMP RAX, RDX
; 4A:       7EF4             JLE L0
; 4C:       488BD1           MOV RDX, RCX
; 4F:       488BE5           MOV RSP, RBP
; 52:       F8               CLC
; 53:       5D               POP RBP
; 54:       C3               RET
NIL
*


On Sun, Feb 18, 2024 at 5:42 PM Robert Boyer <robertstephenboyer@gmail.com>
wrote:

>  If so, we'd be interested to see your code to try and improve our
> compiler.
>
> I hope this helps.  If not, please let me know.
>
>
>
> Robert Boyer <robertstephenboyer@gmail.com>
> 4:19 PM (1 hour ago)
> Reply to all
> to Andreas, Eli, 69249, Andrea, Stefan, rms
> This message is about how important DECLARE and THE are.  If you do not
> handle DECLARE and THE right, people will laugh at native-compile.
>
> Here is an SBCL transcript.  I am running on a $100 Lenovo Chromebook.
>
> I got SBCL with the command sudo apt-get install sbcl.
>
> * (declaim (optimize (safety 0) (speed 3) (debug 0)))
> NIL
> * (defun foo-with-declare (n)
>   (let ((i 0)
>         (sum 0)
>         (max (expt 10 n)))
>     (declare (fixnum i sum max))
>     (loop (cond ((<= i max)
>                  (setq sum (the fixnum (+ sum i))))
>                 (t (return sum)))
>           (incf i))))
> FOO-WITH-DECLARE
> * (time (foo-with-declare 8))
> Evaluation took:
>   0.125 seconds of real time
>   0.123203 seconds of total run time (0.123193 user, 0.000010 system)
>   98.40% CPU
>   135,905,516 processor cycles
>   0 bytes consed
> 5000000050000000
> * (defun foo-without-declare (n)
>   (let ((i 0)
>         (sum 0)
>         (max (expt 10 n)))
>     (loop (cond ((<= i max)
>                  (setq sum (+ sum i)))
>                 (t (return sum)))
>           (incf i))))
> WARNING: redefining COMMON-LISP-USER::FOO-WITHOUT-DECLARE in DEFUN
> FOO-WITHOUT-DECLARE
> * (time (foo-without-declare 8))
> Evaluation took:
>   1.080 seconds of real time
>   1.072932 seconds of total run time (1.072932 user, 0.000000 system)
>   99.35% CPU
>   1,181,369,303 processor cycles
>   0 bytes consed
> 5000000050000000
>
> People go wow about 8X.  How does native-compile do?
>
> There is a great song by Alabama 'If you gonna play in Texas, you gotta
> have a fiddle in the band'. Check it out!
>
> https://www.youtube.com/watch?v=w6r4E514nJg
>
> Bob
>
>
> Bob
>
>
> On Sun, Feb 18, 2024 at 3:28 PM Andreas Schwab <schwab@linux-m68k.org>
> wrote:
>
>> On Feb 18 2024, Robert Boyer wrote:
>>
>> > 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!
>>
>> If you are programming in Emacs Lisp, you need to follow the rules of
>> Emacs Lisp.
>>
>> --
>> Andreas Schwab, schwab@linux-m68k.org
>> GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
>> "And now for something completely different."
>>
>
>
> --
> Anything I seem to state should be taken as a question.  I am at least 77
> and feeble.
> Attachments area
> Preview YouTube video If You're Gonna Play In Texas
> If You're Gonna Play In Texas
> <https://www.youtube.com/watch?v=w6r4E514nJg&authuser=0>
> Reply allReplyForward
> Add reaction
>
> On Sun, Feb 18, 2024 at 5:32 PM Stefan Monnier <monnier@iro.umontreal.ca>
> wrote:
>
>> > ;; 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
>>
>> First thing: these are not error messages!  They're *warnings*!
>>
>> `batch-byte-compile` also gives those warnings, because ELisp does not
>> know those declarations.  The native compiler does support some type
>> annotations, but they do not take this shape.
>>
>> I presume you took those from some other Lisp dialect, but that won't do
>> you much good.  Scheme is not Clojure is not Common Lisp is not ELisp ...
>>
>> BTW, A more recent Emacs would give you an additional warning:
>>
>>     Warning: file has no ‘lexical-binding’ directive on its first line
>>
>> So, I see no bug.  Did the resulting native-compile misbehave in
>> any way?  I presume you're worried about its performance.
>> If so, do you have concrete code where you measured the performance and
>> were disappointed and where you have good reasons to believe that type
>> annotations would make a difference?  If so, we'd be interested to see
>> your code to try and improve our compiler.
>>
>>
>>         Stefan
>>
>>
>
> --
> Anything I seem to state should be taken as a question.  I am at least 77
> and feeble.
>


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

[-- Attachment #2: Type: text/html, Size: 30034 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 22:19       ` Robert Boyer
  2024-02-18 22:25         ` Robert Boyer
@ 2024-02-19  3:30         ` Eli Zaretskii
  2024-02-19  3:58           ` Robert Boyer
  1 sibling, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2024-02-19  3:30 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, acorallo, schwab, monnier, rms

> From: Robert Boyer <robertstephenboyer@gmail.com>
> Date: Sun, 18 Feb 2024 16:19:49 -0600
> Cc: Eli Zaretskii <eliz@gnu.org>, 69249@debbugs.gnu.org, Andrea Corallo <acorallo@gnu.org>, 
> 	Stefan Monnier <monnier@iro.umontreal.ca>, rms@gnu.org
> 
> This message is about how important DECLARE and THE are.  If you do not
> handle DECLARE and THE right, people will laugh at native-compile.

I think you misunderstand what native compilation is and how it works
in Emacs.  It is not what the SBCL compiler does, and thus it doesn't
work according to the same rules.





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

* bug#69249: bug in native-compile?
  2024-02-19  3:30         ` Eli Zaretskii
@ 2024-02-19  3:58           ` Robert Boyer
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-19  3:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 69249, acorallo, schwab, monnier, rms

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

I promise not to talk to you ever again.

Goodbye.

Bob


On Sun, Feb 18, 2024 at 9:30 PM Eli Zaretskii <eliz@gnu.org> wrote:

> > From: Robert Boyer <robertstephenboyer@gmail.com>
> > Date: Sun, 18 Feb 2024 16:19:49 -0600
> > Cc: Eli Zaretskii <eliz@gnu.org>, 69249@debbugs.gnu.org, Andrea Corallo
> <acorallo@gnu.org>,
> >       Stefan Monnier <monnier@iro.umontreal.ca>, rms@gnu.org
> >
> > This message is about how important DECLARE and THE are.  If you do not
> > handle DECLARE and THE right, people will laugh at native-compile.
>
> I think you misunderstand what native compilation is and how it works
> in Emacs.  It is not what the SBCL compiler does, and thus it doesn't
> work according to the same rules.
>


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

[-- Attachment #2: Type: text/html, Size: 1718 bytes --]

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

* bug#69249: bug in native-compile?
  2024-02-18 19:44 ` Eli Zaretskii
  2024-02-18 20:14   ` Robert Boyer
@ 2024-02-19  7:48   ` Andrea Corallo
  2024-02-19 12:49     ` Eli Zaretskii
  1 sibling, 1 reply; 18+ messages in thread
From: Andrea Corallo @ 2024-02-19  7:48 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Robert Boyer, Stefan Monnier, rms, 69249

Eli Zaretskii <eliz@gnu.org> writes:

>> Cc: rms@gnu.org
>> From: Robert Boyer <robertstephenboyer@gmail.com>
>> 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, robertstephenboyer@gmail.com.
>> 
>> ;; 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?

Hi Eli,

yes you are correct, we don't support this (so far at least).

  Andrea





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

* bug#69249: bug in native-compile?
  2024-02-19  7:48   ` Andrea Corallo
@ 2024-02-19 12:49     ` Eli Zaretskii
  0 siblings, 0 replies; 18+ messages in thread
From: Eli Zaretskii @ 2024-02-19 12:49 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: robertstephenboyer, monnier, rms, 69249

severity 69249 wishlist
thanks

> From: Andrea Corallo <acorallo@gnu.org>
> Cc: Robert Boyer <robertstephenboyer@gmail.com>,  Stefan Monnier
>  <monnier@iro.umontreal.ca>,  69249@debbugs.gnu.org,  rms@gnu.org
> Date: Mon, 19 Feb 2024 02:48:58 -0500
> 
> Eli Zaretskii <eliz@gnu.org> writes:
> 
> > 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?
> 
> Hi Eli,
> 
> yes you are correct, we don't support this (so far at least).

OK, thanks.  So I'm changing this bug's severity to "wishlist", as
appropriate for feature requests.





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

* bug#69249: bug in native-compile?
  2024-02-18 23:42   ` Robert Boyer
  2024-02-18 23:46     ` Robert Boyer
@ 2024-02-19 15:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
       [not found]       ` <CAP9n0TOTEZJy8VXeSyMZpT59u0a434_MiwBA0LrwgjH2xc44ww@mail.gmail.com>
  1 sibling, 1 reply; 18+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-19 15:13 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, rms

>  If so, we'd be interested to see your code to try and improve our compiler.
> I hope this helps.  If not, please let me know.

You're just resending what you already sent.
And no it's not much use.
I can easily come up with such examples.
They're only relevant if it impacts real code out there rather than code
specially crafted to test a particular kind of optimization.


        Stefan






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

* bug#69249: bug in native-compile?
       [not found]       ` <CAP9n0TOTEZJy8VXeSyMZpT59u0a434_MiwBA0LrwgjH2xc44ww@mail.gmail.com>
@ 2024-02-20  2:51         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2024-02-20  3:42           ` Robert Boyer
  0 siblings, 1 reply; 18+ messages in thread
From: Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2024-02-20  2:51 UTC (permalink / raw)
  To: Robert Boyer; +Cc: 69249, rms

> However, I have been hacking Lisp hard since 1967, and to me the assertion
> that a Lisp must support THE and DECLARE is about as obvious as the
> assertion that doctors must wash their hands.  An untold number of infants'

There are several subtly different ways to interpret that assertion,
actually, when you're working on the actual implementation of
a compiler.

In the context of ELisp, for example, we wouldn't an incorrect type
declaration to risk crashing your editor, which limits significantly
what can be done and how we can do it.


        Stefan






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

* bug#69249: bug in native-compile?
  2024-02-20  2:51         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2024-02-20  3:42           ` Robert Boyer
  0 siblings, 0 replies; 18+ messages in thread
From: Robert Boyer @ 2024-02-20  3:42 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 69249, rms

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

> In the context of ELisp, for example, we wouldn't an incorrect type
declaration to risk crashing your editor, which limits significantly
what can be done and how we can do it.

I do not get your point.  Errors are a horrible problem we face in every
part of all the code we run.  Software that catches errors is a necessity,
but it does not work perfectly.  I get blown away many times a day and have
to reboot my Chromebook. I cannot easily list all of the things I am
constantly watching out for:  network service disconnection, spilling my
drink on my keyboard, power failures ..., relatives dying, doctors
appointments, ...

I regard errors from declarations as wonderful reports that usually show up
during SBCL compilation.

Bob

On Mon, Feb 19, 2024 at 8:51 PM Stefan Monnier <monnier@iro.umontreal.ca>
wrote:

> > However, I have been hacking Lisp hard since 1967, and to me the
> assertion
> > that a Lisp must support THE and DECLARE is about as obvious as the
> > assertion that doctors must wash their hands.  An untold number of
> infants'
>
> There are several subtly different ways to interpret that assertion,
> actually, when you're working on the actual implementation of
> a compiler.
>
> In the context of ELisp, for example, we wouldn't an incorrect type
> declaration to risk crashing your editor, which limits significantly
> what can be done and how we can do it.
>
>
>         Stefan
>
>

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

[-- Attachment #2: Type: text/html, Size: 2098 bytes --]

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

end of thread, other threads:[~2024-02-20  3:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-18  4:26 bug#69249: bug in native-compile? Robert Boyer
2024-02-18 19:44 ` Eli Zaretskii
2024-02-18 20:14   ` Robert Boyer
2024-02-18 21:28     ` Andreas Schwab
2024-02-18 22:19       ` Robert Boyer
2024-02-18 22:25         ` Robert Boyer
2024-02-18 22:39           ` Robert Boyer
2024-02-19  3:30         ` Eli Zaretskii
2024-02-19  3:58           ` Robert Boyer
2024-02-19  7:48   ` Andrea Corallo
2024-02-19 12:49     ` Eli Zaretskii
2024-02-18 22:45 ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-18 23:32 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-18 23:42   ` Robert Boyer
2024-02-18 23:46     ` Robert Boyer
2024-02-19 15:13     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]       ` <CAP9n0TOTEZJy8VXeSyMZpT59u0a434_MiwBA0LrwgjH2xc44ww@mail.gmail.com>
2024-02-20  2:51         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-02-20  3:42           ` Robert Boyer

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