Subject: bug#76573: 30.1; native compilation fails for record inside function

From: Andrea Corallo <[email-masked]>
Date: Tue, 29 Apr 2025 17:16:15 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: Lin Jian <[email-masked]>
>> Cc: [email-masked],  [email-masked]
>> Date: Sat, 26 Apr 2025 15:50:03 +0800
>> 
>> 
>> My point is not that the code is correct and the compiler is wrong.  To
>> make it crystal clear, my point is that the following situation is
>> confusing and we should make it less so.  At least the author of
>> el-easydraw agrees[1] with me.
>> 
>> 1. This compiler error only appears in Emacs >= 30.
>
> I don't see this as a problem.  Emacs 31 introduces quite a few
> warnings were questionable or wrong techniques are used in Lisp.
>
>> 2. This compiler error does not appear if native-comp-speed < 2.
>
> This is unfortunate, but not unheard of: the same happens with
> compiling code with GCC, for example.
>
> Andrea, can we somehow test this with all the values of
> native-comp-speed?  Why does this pop up only with some values?

Similarly to GCC the compiler uses the same information inferred for
performing optimizations for producing diagnostics.  As a consequence
diagnostics can vary based on the optimization level.  In this specific
case the pass that performs the reasoning that triggers the message
(comp--fwprop) does run only at speed >= 2.