GNU bug report logs - #65017
29.1; Byte compiler interaction with cl-lib function objects, removes symbol-function

Previous Next

Package: emacs;

Reported by: Eric Marsden <eric.marsden <at> risk-engineering.org>

Date: Wed, 2 Aug 2023 13:34:02 UTC

Severity: normal

Found in version 29.1

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


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

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alan Mackenzie <acm <at> muc.de>
Cc: Mattias EngdegÄrd <mattias.engdegard <at> gmail.com>,
 65017 <at> debbugs.gnu.org, Eric Marsden <eric.marsden <at> risk-engineering.org>
Subject: Re: bug#65017: 29.1; Byte compiler interaction with cl-lib function
 objects, removes symbol-function
Date: Wed, 09 Aug 2023 23:41:56 -0400
>> > Are you sure?
>> Yes.
> What about two SWPs with the same symbol but different positions?  If
> they aren't considered EQ here, there will never be a match for the
> first arm of the cond form in cl--labels-convert; then
> cl--labels-convert-cache will get written, but never used.

Nope: when it gets written, the `function` macro returns:

    (function <THESYMWITHPOS>)

so the macro is immediately called again with the *exact* same
<THESYMWITHPOS>, so the second time the `function` macro is called, the
cache does hit (and it's the only case where it should hit), making the
second call to the macro return the *exact* `eq`-same

    (function <THESYMWITHPOS>)

list which is the trick that stops the infinite macroexpansion loop.

Next time the `function` macro is invoked with a "similar" sympos the
cache should *not* match because we don't want to accidentally replace

    (function <SOMESYMWITHPOS>)
with
    (function <THESYMWITHPOS>)

> And if, somehow, it does get used (the current code, I think), then (as
> you write below) the argument F will get replaced by an F with the wrong
> position.  Am I right, here?

That's right.

> Why must the F get replaced by a different F?  There must surely be a
> way, a simpler way than the current cl--labels-convert, to retain the
> current F (hence, not corrupting its position)?

There might.  The current hack is the best I could come up with.

>> > If cl--labels-convert-cache is being used
>> > inside the byte compiler, it surely needs to consider #<symbol foo at
>> > 42> and #<symbol foo at 60> as eq?
>> No, it should not treat them equal (when it does, it introduces an
>> incorrect sympos and can thus lead to error messages pointing at the
>> wrong place).
> Then isn't what is wrong here the introduction of the incorrect SWP
> rather than treating the two SWPs as EQ?

I can't see how to separate one from the other here: the introduction of
the incorrect SWP is due to treating the two SWP as `eq`.

> This is obscure, difficult code.  :-(

Agreed.

> We should think about committing a fix to the original bug,
> sometime, too.

I'm not completely sure we agree yet on what is "the original bug", but
obviously I agree with  your sentence :-)


        Stefan





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

Previous Next


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