GNU bug report logs - #62537
Error compiling emacs master with native compilation activated

Previous Next

Package: emacs;

Reported by: Pedro Andres Aranda Gutierrez <paaguti <at> gmail.com>

Date: Thu, 30 Mar 2023 07:20:02 UTC

Severity: normal

Merged with 62481, 62596, 62644, 62655

Found in versions 29.0.60, 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrea Corallo <akrl <at> sdf.org>
To: Mattias EngdegÄrd <mattiase <at> acm.org>
Cc: 62537 <at> debbugs.gnu.org, Pedro Andres Aranda Gutierrez <paaguti <at> gmail.com>
Subject: bug#62537: Error compiling emacs master with native compilation activated
Date: Fri, 31 Mar 2023 10:26:20 +0000
Andrea Corallo <akrl <at> sdf.org> writes:

> Mattias EngdegÄrd <mattiase <at> acm.org> writes:
>
>> 30 mars 2023 kl. 11.28 skrev Andrea Corallo <akrl <at> sdf.org>:
>>
>>> bisecting this should be due to:
>>> "
>>> 52b67740d10df8ca539fdc2c7d50283997683141
>>
>>> Generalise a LAP optimisation rule
>>
>> That change should be entirely safe. Perhaps it just somehow triggers an unexpected path in nativecomp?
>
> That's entirely possible :)
>
> Will look at and report.
>
>   Andrea

I haven't had time to complete the investigation/fix but as data
point...

This is the most reduced reproducer I could produce:

;;; -*- lexical-binding: t; -*-
(defun test ()
  (when (let
            ((val
              (foo)))
          (cond
           ((eq val 'x)
            t)
           ((eq val 'y)
            'y)))
    (foo))
  t)

This is the old LAP:

(byte-constant foo . 0)
(byte-call . 0)
(byte-dup)
(byte-constant #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (x 8 y 12)) . 1)
(byte-switch)
(byte-goto TAG 16 . 1)
(TAG 8 . 1)
(byte-constant t . 2)
(byte-goto TAG 17 . 2)
(TAG 12 . 1)
(byte-constant t . 2)
(byte-goto TAG 17 . 2)
(TAG 16 . 1)
(byte-constant nil . 3)
(TAG 17 . 2)
(byte-stack-set . 1)
(byte-goto-if-nil TAG 25 . 0)
(byte-constant foo . 0)
(byte-call . 0)
(byte-discard)
(TAG 25 . 0)
(byte-constant t . 2)
(byte-return . 0)

This is the new one:

(byte-constant foo . 0)
(byte-call . 0)
(byte-dup)
(byte-constant #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (x 9 y 9)) . 1)
(byte-switch)
(byte-discard)
(byte-goto TAG 13 . 0)
(TAG 9 . 1)
(byte-discard)
(byte-constant foo . 0)
(byte-call . 0)
(byte-discard)
(TAG 13 . 0)
(byte-constant t . 2)
(byte-return . 0)

At a very quick look I don't see anything wrong with it so as
anticipated most lickly is just a bug in the native compiler limplify
pass.

Best Regards

  Andrea




This bug report was last modified 1 year and 234 days ago.

Previous Next


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