GNU bug report logs -
#46843
28.0.50; [native-comp] (lambda (x) (if (equal x b) (eq x b) (error ""))) miscompiled
Previous Next
Reported by: Pip Cet <pipcet <at> gmail.com>
Date: Mon, 1 Mar 2021 06:53:02 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 46843 in the body.
You can then email your comments to 46843 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46843
; Package
emacs
.
(Mon, 01 Mar 2021 06:53:02 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
.
(Mon, 01 Mar 2021 06:53:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
In *scratch*, evaluate
(funcall
(let* ((lexical-binding t)
(a (list 'a))
(b (cons a a)))
(native-compile
`(lambda (x) (if (equal x ',b) (eq x ',b) (error "")))))
'((a) a))
Expected result:
nil
Actual result:
t
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46843
; Package
emacs
.
(Mon, 01 Mar 2021 08:10:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 46843 <at> debbugs.gnu.org (full text, mbox):
On Mon, Mar 1, 2021 at 6:53 AM Pip Cet <pipcet <at> gmail.com> wrote:
>
> In *scratch*, evaluate
>
> (funcall
> (let* ((lexical-binding t)
> (a (list 'a))
> (b (cons a a)))
> (native-compile
> `(lambda (x) (if (equal x ',b) (eq x ',b) (error "")))))
> '((a) a))
The same issue applies to eql. However, I had to convince myself first
that there is valid and useful code that keeps track of the eq-uality
of eql floats. There is, because there might be an eq-based hash table
that uses them.
(funcall
(let* ((canonical-one 1.0)
(hash (make-hash-table :test 'eq)))
(puthash canonical-one t hash)
(let* ((is-canonical-one
`(lambda (x) (if (eql x ,canonical-one) (eq x
,canonical-one) (error "")))))
(setq is-canonical-one (native-compile is-canonical-one))
`(lambda (x) (if (funcall ',is-canonical-one x) (cl-assert
(gethash x ',hash))))))
1.0)
is miscompiled to code that causes an assertion violation when it
actually is correct code that verifies, in two different ways, that x
is eq to a canonical float representing 1.0.
Pip
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46843
; Package
emacs
.
(Mon, 01 Mar 2021 09:09:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 46843 <at> debbugs.gnu.org (full text, mbox):
Pip Cet <pipcet <at> gmail.com> writes:
> In *scratch*, evaluate
>
> (funcall
> (let* ((lexical-binding t)
> (a (list 'a))
> (b (cons a a)))
> (native-compile
> `(lambda (x) (if (equal x ',b) (eq x ',b) (error "")))))
> '((a) a))
>
> Expected result:
>
> nil
>
> Actual result:
>
> t
Thanks for reporting this, will come-up with a fix.
Andrea
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#46843
; Package
emacs
.
(Mon, 01 Mar 2021 17:27:01 GMT)
Full text and
rfc822 format available.
Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):
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
>> (let* ((lexical-binding t)
>> (a (list 'a))
>> (b (cons a a)))
>> (native-compile
>> `(lambda (x) (if (equal x ',b) (eq x ',b) (error "")))))
>> '((a) a))
>>
>> Expected result:
>>
>> nil
>>
>> Actual result:
>>
>> t
>
> Thanks for reporting this, will come-up with a fix.
Right 3d014e1bf4 is fixing the wrong assumtion that `equal' `eql' can be
treated as `eq' in propagation as every immediate in the compilation
unit is hash consed. Indeed this assumtion is wrong for more than one
reason.
Now under `equal' `eql' we propagate only fixnums and symbols values,
all the other kind of values are promoted to their respective types and
propagated as such.
The patch adds some tests for that too.
As the two reproducer are working here I'm closing this.
Thanks for reporting.
Andrea
Reply sent
to
Andrea Corallo <akrl <at> sdf.org>
:
You have taken responsibility.
(Mon, 01 Mar 2021 17:27:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Pip Cet <pipcet <at> gmail.com>
:
bug acknowledged by developer.
(Mon, 01 Mar 2021 17:27: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
.
(Tue, 30 Mar 2021 11:24:10 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 364 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.