From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 613AB3857836; Sat, 24 Oct 2020 19:26:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 613AB3857836 From: "slyfox at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/97565] New: -flto -ipa-pta ICE: at cgraph_node::get_untransformed_body() Date: Sat, 24 Oct 2020 19:26:40 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: ipa X-Bugzilla-Version: 10.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: slyfox at gcc dot gnu.org 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Oct 2020 19:26:40 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D97565 Bug ID: 97565 Summary: -flto -ipa-pta ICE: at cgraph_node::get_untransformed_body() Product: gcc Version: 10.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: slyfox at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- This is a forward of https://bugs.gentoo.org/750473 ICE where spidermonkey-78.4.0 fails when built with -O1 flto -fipa-pta. Here is the "minimal" 2-file reproducer: // cat abort.cpp extern "C" void abort(void) { abort(); } // cat main.cpp extern "C" void abort(void); int main(int argc, char * argv[]) { abort(); } To crash it reliably on a small example I had to for LTO partitions to smal= lest sizes: $ x86_64-pc-linux-gnu-g++ -o abort.o -flto -O1 -fipa-pta --param=3Dlto-min-partition=3D1 -flto-partition=3Dmax -c abort.cpp $ x86_64-pc-linux-gnu-g++ -o main.o -flto -O1 -fipa-pta --param=3Dlto-min-partition=3D1 -flto-partition=3Dmax -c main.cpp $ x86_64-pc-linux-gnu-g++ -o o -flto -O1 -fipa-pta --param=3Dlto-min-partit= ion=3D1 -flto-partition=3Dmax main.o abort.o during IPA pass: pta lto1: internal compiler error: Segmentation fault 0xa798ba crash_signal =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/toplev.c= :330 0x7fe1b23d4eef ??? =20=20=20=20=20=20=20 /usr/src/debug/sys-libs/glibc-2.32-r2/glibc-2.32/signal/../sysdeps/unix/sys= v/linux/x86_64/sigaction.c:0 0x6ab959 cgraph_node::get_untransformed_body() =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/cgraph.c= :3934 0x6aba89 cgraph_node::get_body() =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/cgraph.c= :3967 0xc2e433 ipa_pta_execute =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-ssa= -structalias.c:8150 0xc2e433 execute =20=20=20=20=20=20=20 /usr/src/debug/sys-devel/gcc-11.0.0_pre9999/gcc-11.0.0_pre9999/gcc/tree-ssa= -structalias.c:8569 Please submit a full bug report, It does not seem to be a regression. I see the same crash on g++-6.5.0=20=20 g++-7.5.0 g++-8.4.0 g++-9.3.0 g++-10.2.0 g++-11.0.0. It seems to have to do with a abort() symbol type. During LTO partition it's not consider either external or internal during partitioning: $ cat o.res 2 main.o 1 203 af1adcfd998498c1 PREVAILING_DEF main abort.o 1 201 8749e101441c301e PREVAILING_DEF_IRONLY_EXP abort I think we expect something like 'RESOLVED_IR abort' (or some form of exter= nal symbol?) for first 'main.o' partition. Otherwise crash happens when attempt to use the information around the symb= ol: Program received signal SIGSEGV, Segmentation fault. 0x000000000056f52a in cgraph_node::get_untransformed_body (this=3D0x7ffff74= 4e2a0) at ../../gcc/gcc/cgraph.c:3920 3920 decl_state->compressed); (gdb) bt #0 0x000000000056f52a in cgraph_node::get_untransformed_body (this=3D0x7ffff744e2a0) at ../../gcc/gcc/cgraph.c:3920 #1 0x000000000056f6b8 in cgraph_node::get_body (this=3D0x7ffff744e2a0) at ../../gcc/gcc/cgraph.c:3951 #2 0x000000000101903a in ipa_pta_execute () at ../../gcc/gcc/tree-ssa-structalias.c:8154 #3 0x000000000101a6df in (anonymous namespace)::pass_ipa_pta::execute (this=3D0x2f09810) at ../../gcc/gcc/tree-ssa-structalias.c:8573 #4 0x0000000000b346b4 in execute_one_pass (pass=3D0x2f09810) at ../../gcc/gcc/passes.c:2517 #5 0x0000000000b35635 in execute_ipa_pass_list (pass=3D0x2f09810) at ../../gcc/gcc/passes.c:2944 #6 0x0000000000582fc4 in symbol_table::compile (this=3D0x7ffff7646100) at ../../gcc/gcc/cgraphunit.c:2805 #7 0x000000000043ba1b in lto_main () at ../../gcc/gcc/lto/lto.c:653 #8 0x0000000000cbd763 in compile_file () at ../../gcc/gcc/toplev.c:460 #9 0x0000000000cc0b25 in do_compile () at ../../gcc/gcc/toplev.c:2321 #10 0x0000000000cc0e3e in toplev::main (this=3D0x7fffffffd4a6, argc=3D20, argv=3D0x2ee3a10) at ../../gcc/gcc/toplev.c:2460 #11 0x0000000001f614e3 in main (argc=3D20, argv=3D0x7fffffffd5b8) at ../../gcc/gcc/main.c:39 (gdb) list 3915 origin =3D origin->clone_of; 3916 3917 int stream_order =3D origin->order - file_data->order_base; 3918 data =3D lto_get_section_data (file_data, LTO_section_function_bo= dy, 3919 name, stream_order, &len, 3920 decl_state->compressed); 3921 if (!data) 3922 fatal_error (input_location, "%s: section %s.%d is missing", 3923 file_data->file_name, name, stream_order); 3924 (gdb) print decl_state $1 =3D (lto_in_decl_state *) 0x0=