Subject: Re: bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation

From: Eli Zaretskii <[email-masked]>
Date: Fri, 23 Jun 2023 15:15:15 +0300

> From: Arash Esbati <[email-masked]>
> Cc: Andrea Corallo <[email-masked]>,  [email-masked],
>   [email-masked],  [email-masked]
> Date: Fri, 23 Jun 2023 13:41:10 +0200
> 
> I'm not tracking 29 branch closely, but from my brief testing:
> 
>  • Emacs builds when running
>    $ ./configure --with-native-compilation && make
>    on the pretest tarball from
>    https://alpha.gnu.org/gnu/emacs/pretest/emacs-29.0.92.tar.xz
> 
>  • Emacs doesn't build out of local git repo when running
>    $ git switch emacs-29
>    $ git clean -fdx
>    $ ./autogen.sh
>    $ ./configure --with-native-compilation && make

This might mean that the problem happens when byte-compiling *.el
files -- in the tarball all the *.elc files are already present.  What
happens if you remove the *.elc files from the release tarball, and
then try building it?

> > Also, why are you using -O3?  That is not recommended when building
> > Emacs.
> 
> I wasn't aware of that.  Can you elaborate why -O3 isn't recommended?

In a nutshell, it bloats the code (due to excessive inlining), with no
real effect on speed.  The inner loops in Emacs are very large, and
thus the techniques used by -O3 to speed up code (loop unrolling etc.)
don't really work.  Moreover, they could make things worse because the
larger loops might no longer fit into the L1 cache of the CPU.

The -O3 is well suited to speed up relatively simple algorithms with
tight loops.  Emacs has very few of those, in the places that matter
for observable performance.