From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#63365: 30.0.50; GCC 13.1 breaks building Emacs with native-compilation Date: Fri, 16 Jun 2023 10:52:26 -0400 Message-ID: References: <831qibu29t.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30244"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63365@debbugs.gnu.org, arash@gnu.org, svraka.andras@gmail.com, Cyril Arnould To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 16 16:53:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qAAp8-0007dl-43 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 16 Jun 2023 16:53:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qAAoy-0006bk-M6; Fri, 16 Jun 2023 10:53:04 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAAow-0006bM-G5 for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 10:53:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qAAow-0004og-8F for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 10:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qAAow-0003MT-4F for bug-gnu-emacs@gnu.org; Fri, 16 Jun 2023 10:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Jun 2023 14:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63365 X-GNU-PR-Package: emacs Original-Received: via spool by 63365-submit@debbugs.gnu.org id=B63365.168692715712883 (code B ref 63365); Fri, 16 Jun 2023 14:53:02 +0000 Original-Received: (at 63365) by debbugs.gnu.org; 16 Jun 2023 14:52:37 +0000 Original-Received: from localhost ([127.0.0.1]:50186 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAAoV-0003Li-Q2 for submit@debbugs.gnu.org; Fri, 16 Jun 2023 10:52:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qAAoS-0003LT-HZ for 63365@debbugs.gnu.org; Fri, 16 Jun 2023 10:52:34 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qAAoM-0004lQ-MC; Fri, 16 Jun 2023 10:52:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=7ZTUn7cvUnp3o2quCXfd1vUNsqHtcqCOGg1z6CSknFY=; b=V9r/FKOxFG5o6NZH3MDU 8ZWW8Xnhp0G0fwacTvxZ49SsErIZuLdlb6U/8t9o+U0zRTxK7myluqaS4R3HZFcUh/b3Vno5/pca1 iJSyjxwBMbWWJQDjxN1MqfuUi+033ofmSiRB3ZEe5BtbniRpf/059cG2ijW3z65chBt5Ld8bm6Ktk v2NZPT7I2eoIGxze/LHYPYNmJc17yh9zVugg5RvOcGLXnoQC9hyNcy0fefDa/xOjZty428ICxn+zD swknLVvnethGvPv3e78eGE/7NHuKlh5IAaYafLIpJvVu5RqC3qBxirbxnPl0yul+sGvY41PFEhe9l dxjfxAUBcRxYjw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1qAAoM-0003Xi-35; Fri, 16 Jun 2023 10:52:26 -0400 In-Reply-To: (Andrea Corallo's message of "Fri, 16 Jun 2023 10:49:13 -0400") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:263474 Archived-At: Andrea Corallo writes: > Eli Zaretskii writes: > >>> From: Cyril Arnould >>> CC: "eliz@gnu.org" , "63365@debbugs.gnu.org" >>> <63365@debbugs.gnu.org>, " akrl@sdf.org" , >>> Andr=C3=A1s Svraka >>> Date: Fri, 16 Jun 2023 09:04:16 +0000 >>>=20 >>> I've been playing around with compiler options. From my findings, the >>>=20 >>> -foptimize-sibling-calls flag breaks the build: >>>=20 >>>=20=20 >>>=20 >>> ./autogen.sh >>>=20 >>> CFLAGS=3D'-g3 -O1 -gdwarf-2 -foptimize-sibling-calls' \ >>>=20 >>> ./configure --with-native-compilation >>>=20 >>> make >>>=20 >>>=20=20 >>>=20 >>> OTOH, using -O1 with every flag listed under -O2 *but* >>>=20 >>> -foptimize-sibling-calls results in the build succeeding. The following >>>=20 >>> works as well for me: >>>=20 >>>=20=20 >>>=20 >>> ./autogen.sh >>>=20 >>> CFLAGS=3D'-g3 -O2 -gdwarf-2 -fno-optimize-sibling-calls' \ >>>=20 >>> ./configure --with-native-compilation >>>=20 >>> 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=3D'-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=3D'-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).=20=20 > > 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