GNU bug report logs - #56739
29.0.50; `cl-psetq' and `cl-psetf' fail to recognize symbol macros

Previous Next

Package: emacs;

Reported by: Wing Hei Chan <whmunkchan <at> outlook.com>

Date: Sun, 24 Jul 2022 12:34:03 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: 56739 <at> debbugs.gnu.org, Wing Hei Chan <whmunkchan <at> outlook.com>
Subject: Re: bug#56739: 29.0.50; `cl-psetq' and `cl-psetf' fail to recognize
 symbol macros
Date: Mon, 05 Sep 2022 22:22:28 -0400
> -  (let ((p args) (simple t) (vars nil))
> +  (let ((p args) (simple t) (vars nil)
> +        (smacros (alist-get :cl-symbol-macros macroexpand-all-environment)))
>      (while p
> -      (if (or (not (symbolp (car p))) (cl--expr-depends-p (nth 1 p) vars))
> -	  (setq simple nil))
> -      (if (memq (car p) vars)
> -	  (error "Destination duplicated in psetf: %s" (car p)))
> +      (when (or (not (symbolp (car p)))
> +                (assq (car p) smacros)

This looks like a safe way to make it work when the place is
a symbol macro.

> +                (and (symbolp (nth 1 p))
> +                     (assq (nth 1 p) smacros))
> +                (cl--expr-depends-p (nth 1 p) vars))

But this doesn't look strong enough; if (nth 1 p) is (+ c c) where `c`
is a symbol macro the same problem will appear.  So the test needs to be
pushed into `cl--expr-depends-p` (probably into `cl--safe-expr-p` where
it will fix other related problems elsewhere).


        Stefan





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

Previous Next


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