[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilati
From: |
Andrea Corallo |
Subject: |
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation |
Date: |
Fri, 16 Jun 2023 10:52:26 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Andrea Corallo <acorallo@gnu.org> writes:
> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> From: Cyril Arnould <cyril.arnould@outlook.com>
>>> CC: "eliz@gnu.org" <eliz@gnu.org>, "63365@debbugs.gnu.org"
>>> <63365@debbugs.gnu.org>, " akrl@sdf.org" <akrl@sdf.org>,
>>> AndrĂ¡s Svraka <svraka.andras@gmail.com>
>>> Date: Fri, 16 Jun 2023 09:04:16 +0000
>>>
>>> I've been playing around with compiler options. From my findings, the
>>>
>>> -foptimize-sibling-calls flag breaks the build:
>>>
>>>
>>>
>>> ./autogen.sh
>>>
>>> CFLAGS='-g3 -O1 -gdwarf-2 -foptimize-sibling-calls' \
>>>
>>> ./configure --with-native-compilation
>>>
>>> make
>>>
>>>
>>>
>>> OTOH, using -O1 with every flag listed under -O2 *but*
>>>
>>> -foptimize-sibling-calls results in the build succeeding. The following
>>>
>>> works as well for me:
>>>
>>>
>>>
>>> ./autogen.sh
>>>
>>> CFLAGS='-g3 -O2 -gdwarf-2 -fno-optimize-sibling-calls' \
>>>
>>> ./configure --with-native-compilation
>>>
>>> make
>>
>> Andrea, any reason that this GCC switch should break
>> native-compilation?
>
> At this point I start to suspect that this is not strictly related to
> native compilation.
>
> The configure flags are used only for our regular C code and not for
> Elisp native compilation. So it might be that some kind of
> misscompilaiton of our C code is happening only with
> --with-native-compilation, but looks to me it's not our compiler or
> libgccjit the issue here.
>
>> Does the same problem happen on GNU/Linux?
>
> I tried now on GCC 13.1.1
>
> git clean -xfd && ./autogen.sh
> CFLAGS='-g3 -O1 -gdwarf-2 -foptimize-sibling-calls'
> ./configure --with-native-compilation && make -j16
>
> and have complete bootstrap succesfully on emacs-29 (65f355ea0a3), my
> dev machine is still x86_64-pc-linux-gnu.
>
> One idea might be asking GCC to log what optimize-sibling-calls is doing
> and see if any of our C function supporting native compilation is
> touched by this pass (I believe is called in GCC tree-tailcall).
>
> CFLAGS='-g3 -O1 -gdwarf-2 -foptimize-sibling-calls -fdump-tree-tailr' && make
> bootstrap
>
> should let GCC dump what this pass is for each C compilation unit, I'd
> start looking at the output for comp.c (I've comp.c.045t.tailr1 and
> comp.c.125t.tailr2).
>
> Hope it helps!
>
> Andrea
Just to add...
Looking at GCC source code, one should be able to grep within those
files for "Found tail call " or "Eliminated tail recursion in bb" as a
marker of some optimization happening there :)
Best Regards
Andrea
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, (continued)
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Arash Esbati, 2023/06/08
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Cyril Arnould, 2023/06/16
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Arash Esbati, 2023/06/22
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Eli Zaretskii, 2023/06/23
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Arash Esbati, 2023/06/23
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Eli Zaretskii, 2023/06/23
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Arash Esbati, 2023/06/23
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Deus Max, 2023/06/24
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Eli Zaretskii, 2023/06/24
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Deus Max, 2023/06/24
- bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Eli Zaretskii, 2023/06/24
bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation, Andrea Corallo, 2023/06/25