GNU bug report logs - #63365
30.0.50; GCC 13.1 breaks building Emacs with native-compilation

Previous Next

Package: emacs;

Reported by: Arash Esbati <arash <at> gnu.org>

Date: Mon, 8 May 2023 08:17:02 UTC

Severity: normal

Tags: moreinfo

Merged with 65727

Found in version 30.0.50

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


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

From: Andrea Corallo <acorallo <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 63365 <at> debbugs.gnu.org, arash <at> gnu.org, svraka.andras <at> gmail.com,
 Cyril Arnould <cyril.arnould <at> outlook.com>
Subject: Re: bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with
 native-compilation
Date: Fri, 16 Jun 2023 10:49:13 -0400
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Cyril Arnould <cyril.arnould <at> outlook.com>
>> CC: "eliz <at> gnu.org" <eliz <at> gnu.org>, "63365 <at> debbugs.gnu.org"
>> 	<63365 <at> debbugs.gnu.org>, "  akrl <at> sdf.org" <akrl <at> sdf.org>,
>> 	AndrĂ¡s Svraka <svraka.andras <at> 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




This bug report was last modified 1 year and 1 day ago.

Previous Next


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