From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 515963858D38; Mon, 19 Feb 2024 16:14:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 515963858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1708359286; bh=vmQKibeuatnhyz/MYacXpNg3XqCcAvp43pHDrZffUG8=; h=From:To:Subject:Date:From; b=UDWoKrHgKpcNZeLQnDyntV0zGtq30S13CFWU+o/dkcyJyi5epOpz0lZVkWrmAJt0w 2HsnTOxvVKwkgOJd6lDD5H/NGjxAIMmKiqNKufl+MnpjQyuq2PfxRGNaB3/onu74TV UIPxusyn0CKfLzawrekdOz3+Ago5ZcprEuRObsqw= From: "jcmoyer32 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug ada/113996] New: ICE with LTO and full optimizations Date: Mon, 19 Feb 2024 16:14:45 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ada X-Bugzilla-Version: 13.2.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jcmoyer32 at gmail dot com X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: 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=3D113996 Bug ID: 113996 Summary: ICE with LTO and full optimizations Product: gcc Version: 13.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada Assignee: unassigned at gcc dot gnu.org Reporter: jcmoyer32 at gmail dot com CC: dkm at gcc dot gnu.org Target Milestone: --- Building the following program with `gnatmake example.adb -O2 -gnatp -flto` causes an ICE: -------------------------------- with Ada.Containers.Hashed_Maps; with Ada.Strings.Hash; procedure example is subtype Node_Name is String (1 .. 4); package Node_Maps is new Ada.Containers.Hashed_Maps (Key_Type =3D> Node_Name, Element_Type =3D> Integer, Hash =3D> Ada.Strings.Hash, Equivalent_Keys =3D> "=3D"); begin null; end example; -------------------------------- [x@arch ~]# gnatmake -f example.adb -O2 -gnatp -flto gcc -c -O2 -gnatp -flto example.adb gnatbind -x example.ali gnatlink example.ali -O2 -flto during IPA pass: inline In function =E2=80=98example__node_maps__find_equal_key=E2=80=99, inlined from =E2=80=98example__node_maps__is_equal=E2=80=99 at /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/adainclude/a-chtgop.adb:410:20, inlined from =E2=80=98example__node_maps__Oeq__3=E2=80=99 at /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/adainclude/a-cohama.adb:128:14: /usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/adainclude/a-cohama.adb:500:46: internal compiler error: in initialize_inlined_parameters, at tree-inline.cc:3659 500 | R_Index : constant Hash_Type :=3D Key_Ops.Index (R_HT, L_Node= .Key); | ^ 0x1851644 internal_error(char const*, ...) ???:0 0x67856f fancy_abort(char const*, int, char const*) ???:0 0xc20fe1 optimize_inline_calls(tree_node*) ???:0 0x9629cb inline_transform(cgraph_node*) ???:0 0xaf423f execute_all_ipa_transforms(bool) ???:0 0x76c19e cgraph_node::expand() ???:0 0x6d86f3 lto_main() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. lto-wrapper: fatal error: /usr/bin/gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status gnatlink: error when calling /usr/bin/gcc gnatmake: *** link failed. -------------------------------- I've tested this on: - Arch Linux 6.5.9 + gcc 13.2.1: ICE - Windows 10 + gcc 13.2.0 from MSYS2-mingw64: ICE - godbolt: all versions of gnat from 9.x onwards: ICE; 8.x successfully compiles There are several workarounds I've found; each of these produces a successf= ul compile: - Provide my own hash function - Copy the implementation of Ada.Strings.Hash to my source file and use that one - Drop the optimization level from -O2 to -O1 - Remove -gnatp - Remove -flto (replacing it with -gnatn also works)=