From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5F78D3858282; Fri, 8 Dec 2023 08:01:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5F78D3858282 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1702022474; bh=e9bm+V7x8LXf5YPqQB9tLM7tww8jFG2Eg6VKTHmfeZ4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=fnVJj78JDOS4keF6MmRiX3WAUNH0qjclJumPQNxJKjWdhbDh0a8WSmwhIelG9saeM MoI3yA+dx8XAALIQvHpc/w7D6RikWz/FBEfzcp0HtnG6fvIN4JTIixJhPbG8mYtS+l gaFUAke/xLTdO1f0hzhlPMUBVzoK8/+dY+Xix0bY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/112411] ICE: SIGSEGV with --param=min-nondebug-insn-uid=2147483647 on powerpc64le-unknown-linux-gnu Date: Fri, 08 Dec 2023 08:01:09 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D112411 --- Comment #12 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:8f60f5499e10d19218cada082e0909516ebf0e74 commit r14-6305-g8f60f5499e10d19218cada082e0909516ebf0e74 Author: Jakub Jelinek Date: Fri Dec 8 08:56:33 2023 +0100 haifa-sched: Avoid overflows in extend_h_i_d [PR112411] On Thu, Dec 07, 2023 at 09:36:23AM +0100, Jakub Jelinek wrote: > Without the dg-skip-if I got on 64-bit host with > -O3 --param min-nondebug-insn-uid=3D0x40000000: > cc1: out of memory allocating 571230784744 bytes after a total of 277= 2992 bytes I've looked at this and the problem is in haifa-sched.cc: 9047 h_i_d.safe_grow_cleared (3 * get_max_uid () / 2, true); get_max_uid () is 0x4000024d with the --param min-nondebug-insn-uid=3D0x40000000 and so 3 * get_max_uid () / 2 actually overflows to -536870028 but as v= ec.h then treats the value as unsigned, it attempts to allocate 0xe0000374U * 152UL bytes, i.e. those 532GB. If the above is fixed to = do 3U * get_max_uid () / 2 instead, it will get slightly better and will o= nly need 0x60000373U * 152UL bytes, i.e. 228GB. Perhaps more could be helped by making the vector indirect (contain pointers to haifa_insn_data_def rather than the structures themselves) and pool allocate those, but the more important question is how sparse are uids in normal compilations without those large --param min-nondebug-insn-uid=3D param= eters. Because if they aren't enough, such a change would increase compile time memory just to help the unusual case. 2023-12-08 Jakub Jelinek PR middle-end/112411 * haifa-sched.cc (extend_h_i_d): Use 3U instead of 3 in 3 * get_max_uid () / 2 calculation.=