GNU bug report logs - #53071
28.0.90; Emacs 28 regression: incorrect code generation for complex pcase forms?

Previous Next

Package: emacs;

Reported by: Philipp Stephani <p.stephani2 <at> gmail.com>

Date: Fri, 7 Jan 2022 09:37:02 UTC

Severity: normal

Found in version 28.0.90

Done: Mattias Engdegård <mattiase <at> acm.org>

Bug is archived. No further changes may be made.

Full log


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

From: Philipp <p.stephani2 <at> gmail.com>
To: 53071 <at> debbugs.gnu.org
Subject: Re: bug#53071: 28.0.90; Emacs 28 regression: incorrect code
 generation for complex pcase forms?
Date: Wed, 12 Jan 2022 03:19:42 +0100

> Am 07.01.2022 um 10:36 schrieb Philipp Stephani <p.stephani2 <at> gmail.com>:
> 
> 
> I hit the following subtle Edebug regression in Emacs 28:
> 
> Create a file /tmp/pcase-edebug.el with these contents:
> 
> $ cat /tmp/pcase-edebug.el 
> ;; -*- lexical-binding: t; -*-
> (require 'rx)
> (defun f (a)
>  (pcase a
>    ((rx bos (let q (opt (let r nonl)) (let a nonl)))
>     (message "%s" a))
>    ((rx bos eos)
>     (message "%s" a))))
> 
> Visit the file in Emacs:
> 
> $ emacs -Q -l rx /tmp/pcase-edebug.el
> 
> Move point into the `f' function and instrument it using C-u C-M-x.
> Then, byte-compile `f' using M-: (byte-compile 'f).
> In Emacs 28, this will generate the following warnings:
> 
> Warning: Unused lexical variable `q'
> Warning: Unused lexical variable `r'
> Warning: reference to free variable ‘a’
> 
> The first two are expected, the third one is not.
> Indeed, M-: (f "ab") and stepping through the code will signal an error:
> 
>   Symbol's value as variable is void: a

'git bisect' claims that the following commit is the culprit:

commit 1362a9fec4dff341a84c881ac17dbf1ee2cf82fd
Author: Mattias Engdegård <mattiase <at> acm.org>
Date:   Fri Mar 5 20:21:01 2021 +0100

    Make lambda-lifting work again
    





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

Previous Next


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