From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1CF5F3858C5F; Wed, 1 Feb 2023 16:07:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1CF5F3858C5F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675267622; bh=UV1/9i9fputfHityNoi9TJLmT1jOaL5uJLTZt/e2Hwo=; h=From:To:Subject:Date:In-Reply-To:References:From; b=KRp2HSpWYtLjIyO2sbvbxeUuQUYeUztkvWk7js7DCH9jwVRGOHOZ9ScVBiOIBQO3x uu5ox6mkn9wa0xBx6yZOU5YwiJsuJhY097kOIypzFuBGQpsRYjLsXZSxY+OmFUTuzJ b6OpwLhplW+0gl+s3MMtxYmuVemgekGdkjgMwqhk= From: "dhekir at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108500] [11/12 Regression] -O -finline-small-functions results in "internal compiler error: Segmentation fault" on a very large program (700k function calls) Date: Wed, 01 Feb 2023 16:07:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 12.2.0 X-Bugzilla-Keywords: compile-time-hog, ice-on-valid-code, memory-hog X-Bugzilla-Severity: normal X-Bugzilla-Who: dhekir at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108500 --- Comment #13 from dhekir at gmail dot com --- Thank you very much for the work. Running the attached file with `-O -finline-small-functions` does compile in under 30 seconds on my computer. However, when trying to compile the original program (which is about 1 mill= ion lines, and each call passes 2 structures as arguments, instead of just call= ing a function without any arguments), it's taking several dozen minutes. I tri= ed preprocessing it (5s to obtain the .i) file, and then running it with `-O -finline-small-functions`, or `-O2`, or `-O3`, and without any options at a= ll, and in all cases, I ended up terminating the program before it finished (af= ter more than 10 minutes; in some cases I waited up to 30 minutes). I tried re-simplifying the program. After preprocessing, I tried the follow= ing variants, with options `-O -finline-small-functions`: - 1M calls, no arguments, function returning a (global) struct: compiles in 30s; - 1M calls, each with a single argument of type `struct s`, function returns that same argument (that is, `struct s f(struct s s1) {return s1;}`): compi= les in <2 minutes; - 1M calls, each with 2 arguments of types `struct s1` and `struct s2`, returning the second argument (that is, `struct s2 f(struct s1 arg1, struct= s2 arg2) {return arg2;}`): >50 minutes (I had to terminate it). The last version, with -O2, I left it compiling for almost 3h before having= to stop it. In any case, this bug seems definitely solved for me, and I no longer have = the original stack overflow. However, I am still unable to compile my original code, so I'll have to try something else. It's possibly not a regression, however. I'm attaching it in case you may want to try it, but feel free to ignore it= .=