unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled
@ 2021-02-27 13:53 Pip Cet
  2021-02-27 13:57 ` Pip Cet
  2021-02-27 21:15 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 2 replies; 5+ messages in thread
From: Pip Cet @ 2021-02-27 13:53 UTC (permalink / raw)
  To: 46812

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





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

* bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled
  2021-02-27 13:53 bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled Pip Cet
@ 2021-02-27 13:57 ` Pip Cet
  2021-02-27 21:15 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 0 replies; 5+ messages in thread
From: Pip Cet @ 2021-02-27 13:57 UTC (permalink / raw)
  To: 46812

On Sat, Feb 27, 2021 at 1:54 PM Pip Cet <pipcet@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





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

* bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled
  2021-02-27 13:53 bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled Pip Cet
  2021-02-27 13:57 ` Pip Cet
@ 2021-02-27 21:15 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-02-28 23:03   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  1 sibling, 1 reply; 5+ messages in thread
From: Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-27 21:15 UTC (permalink / raw)
  To: Pip Cet; +Cc: 46812

Pip Cet <pipcet@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





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

* bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled
  2021-02-27 21:15 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-02-28 23:03   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
  2021-03-01  6:57     ` Pip Cet
  0 siblings, 1 reply; 5+ messages in thread
From: Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2021-02-28 23:03 UTC (permalink / raw)
  To: 46812; +Cc: 46812-done, Pip Cet

Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> Pip Cet <pipcet@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





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

* bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled
  2021-02-28 23:03   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2021-03-01  6:57     ` Pip Cet
  0 siblings, 0 replies; 5+ messages in thread
From: Pip Cet @ 2021-03-01  6:57 UTC (permalink / raw)
  To: Andrea Corallo; +Cc: 46812-done, 46812

On Sun, Feb 28, 2021 at 11:03 PM Andrea Corallo <akrl@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





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

end of thread, other threads:[~2021-03-01  6:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-27 13:53 bug#46812: 28.0.50; [native-comp] (lambda (x) (if (= x 0.0) (floatp x) (error ""))) miscompiled Pip Cet
2021-02-27 13:57 ` Pip Cet
2021-02-27 21:15 ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-02-28 23:03   ` Andrea Corallo via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-03-01  6:57     ` Pip Cet

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