GNU bug report logs - #46812
28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled

Previous Next

Package: emacs;

Reported by: Pip Cet <pipcet <at> gmail.com>

Date: Sat, 27 Feb 2021 13:54:01 UTC

Severity: normal

Found in version 28.0.50

Done: Andrea Corallo <akrl <at> sdf.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 46812 in the body.
You can then email your comments to 46812 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Sat, 27 Feb 2021 13:54:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pip Cet <pipcet <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 27 Feb 2021 13:54:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error
 ""))) miscompiled
Date: Sat, 27 Feb 2021 13:53:12 +0000
In *scratch*, evaluate

(funcall (native-compile `(lambda (x) (if (= x 0.0) (floatp x) (error "")))) 0)

Expected Result:

nil

Actual Result:

t

[Note that this depends on lexical binding being in effect]

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.24, cairo version 1.16.0)
 of 2021-02-27 built
Repository revision: 42fc752a14b23be95f02b598930f13a96883d3a0
Repository branch: HEAD
Windowing system distributor 'The X.Org Foundation', version 11.0.12010000
System Description: Debian GNU/Linux bullseye/sid

Configured using:
 'configure --with-native-compilation'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY
PDUMPER PNG RSVG 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: Lisp Interaction

Minor modes in effect:
  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
  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 dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source eieio eieio-core eieio-loaddefs
password-cache json map text-property-search mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date
help-fns radix-tree cl-print debug backtrace find-func comp comp-cstr
warnings subr-x rx cl-seq cl-macs cl-extra help-mode easymenu seq
byte-opt gv cl-loaddefs cl-lib bytecomp byte-compile cconv 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
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
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 pcase 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
nativecomp emacs)

Memory information:
((conses 16 94746 8286)
 (symbols 48 8212 1)
 (strings 32 25369 3647)
 (string-bytes 1 846362)
 (vectors 16 17343)
 (vector-slots 8 322768 22051)
 (floats 8 27 89)
 (intervals 56 288 0)
 (buffers 992 15))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Sat, 27 Feb 2021 13:59:03 GMT) Full text and rfc822 format available.

Message #8 received at 46812 <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> gmail.com>
To: 46812 <at> debbugs.gnu.org
Subject: Re: bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0)
 (floatp x) (error ""))) miscompiled
Date: Sat, 27 Feb 2021 13:57:35 +0000
On Sat, Feb 27, 2021 at 1:54 PM Pip Cet <pipcet <at> gmail.com> wrote:
> In *scratch*, evaluate
>
> (funcall (native-compile `(lambda (x) (if (= x 0.0) (floatp x) (error "")))) 0)
>
> Expected Result:
>
> nil
>
> Actual Result:
>
> t
>
> [Note that this depends on lexical binding being in effect]

This arose from a discussion in bug#46670, and the relevant comment
with a fix (which unfortunately disables some correct optimizations in
addition to the incorrect ones) is at
https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-02/msg01630.html.

It's important we fix this correctly, but I'm predicting we won't.

Pip




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Sat, 27 Feb 2021 21:17:02 GMT) Full text and rfc822 format available.

Message #11 received at 46812 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Pip Cet <pipcet <at> gmail.com>
Cc: 46812 <at> debbugs.gnu.org
Subject: Re: bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0)
 (floatp x) (error ""))) miscompiled
Date: Sat, 27 Feb 2021 21:15:57 +0000
Pip Cet <pipcet <at> gmail.com> writes:

> In *scratch*, evaluate
>
> (funcall (native-compile `(lambda (x) (if (= x 0.0) (floatp x) (error "")))) 0)

Nice reproducer for a nice bug.

This week-end I'm mostly off, will come back on this very quickly.

Thanks for reporting.

  Andrea




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Sun, 28 Feb 2021 23:04:02 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <akrl <at> sdf.org>
To: Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
 text editors" <bug-gnu-emacs <at> gnu.org>
Cc: 46812-done <at> debbugs.gnu.org, Pip Cet <pipcet <at> gmail.com>
Subject: Re: bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0)
 (floatp x) (error ""))) miscompiled
Date: Sun, 28 Feb 2021 23:03:37 +0000
Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

> Pip Cet <pipcet <at> gmail.com> writes:
>
>> In *scratch*, evaluate
>>
>> (funcall (native-compile `(lambda (x) (if (= x 0.0) (floatp x) (error "")))) 0)
>
> Nice reproducer for a nice bug.
>
> This week-end I'm mostly off, will come back on this very quickly.
>

Here what was going on:

`=' was treated homogeneously with other equality operators and in the
'then' branch of:

(if (= x 0.0)
    then
  else)

we were assuming x being 0.0.

Indeed that's not correct as `=' has a more complex semantic allowing
mixed integer float comparisons; ex (= 0 0.0) is satisfied.

5bc08559e8 allow now fwprop to propagate `=' semantic hopefully
correctly, the patch adds also a bunch of tests to check for this.

Closing as the reproducer is passing here.

Thanks for reporting

  Andrea




Reply sent to Andrea Corallo <akrl <at> sdf.org>:
You have taken responsibility. (Sun, 28 Feb 2021 23:04:02 GMT) Full text and rfc822 format available.

Notification sent to Pip Cet <pipcet <at> gmail.com>:
bug acknowledged by developer. (Sun, 28 Feb 2021 23:04:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Mon, 01 Mar 2021 06:58:02 GMT) Full text and rfc822 format available.

Message #22 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pip Cet <pipcet <at> gmail.com>
To: Andrea Corallo <akrl <at> sdf.org>
Cc: "Andrea Corallo via Bug reports for GNU Emacs,
 the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>,
 46812-done <at> debbugs.gnu.org
Subject: Re: bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0)
 (floatp x) (error ""))) miscompiled
Date: Mon, 1 Mar 2021 06:57:02 +0000
On Sun, Feb 28, 2021 at 11:03 PM Andrea Corallo <akrl <at> sdf.org> wrote:
> Closing as the reproducer is passing here.

So you really want me to keep coming up with obvious variants of this
bug and fix them one by one, until there are no obvious variants of it
left and we're still left with a bug, just a less obvious one?

I think that's noisy, inefficient, and it will still leave us with
bugs in our code. I'm opening a bug for the real issue.

Pip




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#46812; Package emacs. (Mon, 01 Mar 2021 06:58:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 29 Mar 2021 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 26 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.