From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9E77F3858D35; Thu, 7 Mar 2024 20:01:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9E77F3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709841709; bh=1FkeULokX5SB+zAQJvXmaKngEvzmnrKRzpYAyrq7eiU=; h=From:To:Subject:Date:From; b=DjOf19ixwp0hkc92wMWW79a7A16qeJ974ukUzAW2TBPK1f005Vy9J01OfOQNmWueS Q2pagDvoBP3b3RiOMZPmod+cTxv6FvDFi3BkY8zRGIBLeubNY+WLm6ZN73bCJb/Mb+ gzr+vzte0VNMuYQogwcqvswKWXrlvUjYOcKFT3PM= From: "zsojka at seznam dot cz" To: gcc-bugs@gcc.gnu.org Subject: [Bug ipa/114274] New: ICE: tree check: expected block, have ggc_freed in inlining_chain_to_json, at optinfo-emit-json.cc:284 with -fsave-optimization-record Date: Thu, 07 Mar 2024 20:01:47 +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: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: zsojka at seznam dot cz 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 keywords bug_severity priority component assigned_to reporter target_milestone cf_gcchost cf_gcctarget attachments.created 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=3D114274 Bug ID: 114274 Summary: ICE: tree check: expected block, have ggc_freed in inlining_chain_to_json, at optinfo-emit-json.cc:284 with -fsave-optimization-record Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: ipa Assignee: unassigned at gcc dot gnu.org Reporter: zsojka at seznam dot cz Target Milestone: --- Host: x86_64-pc-linux-gnu Target: x86_64-pc-linux-gnu Created attachment 57649 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D57649&action=3Dedit partially reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc --param=3Dmax-jump-thread-duplication-stmts=3D0 -fprofile-generate -O2 -fsave-optimization-record aco_ir.cpp.ii -wrapper valgrind,-q aco_ir.cpp.ii:50:66: warning: 'alloc_size' attribute ignored on a function returning 'void' [-Wattributes] 50 | void malloc () __attribute__ ((__alloc_size__ (1))) ; | ^ ... aco_ir.cpp.ii: At global scope: aco_ir.cpp.ii:1257:49: warning: 'always_inline' function might not be inlin= able unless also declared 'inline' [-Wattributes] 1257 | __attribute__((always_inline)) bool get_cmp_info(aco_op= code op, CmpInfo* info) { | ^~~~~~~~~~~~ =3D=3D30423=3D=3D Invalid read of size 2 =3D=3D30423=3D=3D at 0x16AB1A0: tree_check (tree.h:3611) =3D=3D30423=3D=3D by 0x16AB1A0: optrecord_json_writer::inlining_chain_to_json(unsigned int) (optinfo-emit-json.cc:284) =3D=3D30423=3D=3D by 0x16ABF4A: optrecord_json_writer::optinfo_to_json(o= ptinfo const*) (optinfo-emit-json.cc:419) =3D=3D30423=3D=3D by 0x16ABF98: optrecord_json_writer::add_record(optinf= o const*) (optinfo-emit-json.cc:141) =3D=3D30423=3D=3D by 0x1318F06: emit_optinfo (dumpfile.cc:1223) =3D=3D30423=3D=3D by 0x1318F06: end_any_optinfo (dumpfile.cc:1209) =3D=3D30423=3D=3D by 0x1318F06: dump_loc (dumpfile.cc:601) =3D=3D30423=3D=3D by 0x1318F06: dump_printf_loc_va (dumpfile.cc:1028) =3D=3D30423=3D=3D by 0x1318F06: dump_printf_loc(dump_metadata_t const&, dump_user_location_t const&, char const*, ...) (dumpfile.cc:1359) =3D=3D30423=3D=3D by 0x2B483D4: ipa_icf::sem_item_optimizer::merge_class= es(unsigned int, unsigned int) (ipa-icf.cc:3423) =3D=3D30423=3D=3D by 0x2B501F4: ipa_icf::sem_item_optimizer::execute() (ipa-icf.cc:2484) =3D=3D30423=3D=3D by 0x2B53726: ipa_icf_driver (ipa-icf.cc:3612) =3D=3D30423=3D=3D by 0x2B53726: ipa_icf::pass_ipa_icf::execute(function*) (ipa-icf.cc:3659) =3D=3D30423=3D=3D by 0x16DBC27: execute_one_pass(opt_pass*) (passes.cc:2= 646) =3D=3D30423=3D=3D by 0x16DCF96: execute_ipa_pass_list(opt_pass*) (passes= .cc:3095) =3D=3D30423=3D=3D by 0x12D7DB0: ipa_passes (cgraphunit.cc:2272) =3D=3D30423=3D=3D by 0x12D7DB0: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2335) =3D=3D30423=3D=3D by 0x12DAB57: compile (cgraphunit.cc:2315) =3D=3D30423=3D=3D by 0x12DAB57: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2587) =3D=3D30423=3D=3D by 0x181C671: compile_file() (toplev.cc:476) =3D=3D30423=3D=3D Address 0x5d5bde0 is in a rw- anonymous segment =3D=3D30423=3D=3D=20 =3D=3D30423=3D=3D Invalid read of size 2 =3D=3D30423=3D=3D at 0x96F1A7: tree_check_failed(tree_node const*, char = const*, int, char const*, ...) (tree.cc:8955) =3D=3D30423=3D=3D by 0x8BF5B1: tree_check (tree.h:3612) =3D=3D30423=3D=3D by 0x8BF5B1: optrecord_json_writer::inlining_chain_to_json(unsigned int) [clone .cold] (optinfo-emit-json.cc:284) =3D=3D30423=3D=3D by 0x16ABF4A: optrecord_json_writer::optinfo_to_json(o= ptinfo const*) (optinfo-emit-json.cc:419) =3D=3D30423=3D=3D by 0x16ABF98: optrecord_json_writer::add_record(optinf= o const*) (optinfo-emit-json.cc:141) =3D=3D30423=3D=3D by 0x1318F06: emit_optinfo (dumpfile.cc:1223) =3D=3D30423=3D=3D by 0x1318F06: end_any_optinfo (dumpfile.cc:1209) =3D=3D30423=3D=3D by 0x1318F06: dump_loc (dumpfile.cc:601) =3D=3D30423=3D=3D by 0x1318F06: dump_printf_loc_va (dumpfile.cc:1028) =3D=3D30423=3D=3D by 0x1318F06: dump_printf_loc(dump_metadata_t const&, dump_user_location_t const&, char const*, ...) (dumpfile.cc:1359) =3D=3D30423=3D=3D by 0x2B483D4: ipa_icf::sem_item_optimizer::merge_class= es(unsigned int, unsigned int) (ipa-icf.cc:3423) =3D=3D30423=3D=3D by 0x2B501F4: ipa_icf::sem_item_optimizer::execute() (ipa-icf.cc:2484) =3D=3D30423=3D=3D by 0x2B53726: ipa_icf_driver (ipa-icf.cc:3612) =3D=3D30423=3D=3D by 0x2B53726: ipa_icf::pass_ipa_icf::execute(function*) (ipa-icf.cc:3659) =3D=3D30423=3D=3D by 0x16DBC27: execute_one_pass(opt_pass*) (passes.cc:2= 646) =3D=3D30423=3D=3D by 0x16DCF96: execute_ipa_pass_list(opt_pass*) (passes= .cc:3095) =3D=3D30423=3D=3D by 0x12D7DB0: ipa_passes (cgraphunit.cc:2272) =3D=3D30423=3D=3D by 0x12D7DB0: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2335) =3D=3D30423=3D=3D by 0x12DAB57: compile (cgraphunit.cc:2315) =3D=3D30423=3D=3D by 0x12DAB57: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2587) =3D=3D30423=3D=3D Address 0x5d5bde0 is in a rw- anonymous segment =3D=3D30423=3D=3D=20 during IPA pass: icf aco_ir.cpp.ii:1335:13: internal compiler error: tree check: expected block, have ggc_freed in inlining_chain_to_json, at optinfo-emit-json.cc:284 1335 | } | ^ 0x96f1eb tree_check_failed(tree_node const*, char const*, int, char const*, ...) /repo/gcc-trunk/gcc/tree.cc:8955 0x8bf5b1 tree_check(tree_node*, char const*, int, char const*, tree_code) /repo/gcc-trunk/gcc/tree.h:3612 0x8bf5b1 optrecord_json_writer::inlining_chain_to_json(unsigned int) /repo/gcc-trunk/gcc/optinfo-emit-json.cc:284 0x16abf4a optrecord_json_writer::optinfo_to_json(optinfo const*) /repo/gcc-trunk/gcc/optinfo-emit-json.cc:419 0x16abf98 optrecord_json_writer::add_record(optinfo const*) /repo/gcc-trunk/gcc/optinfo-emit-json.cc:141 0x1318f06 dump_context::emit_optinfo(optinfo const*) /repo/gcc-trunk/gcc/dumpfile.cc:1223 0x1318f06 dump_context::end_any_optinfo() /repo/gcc-trunk/gcc/dumpfile.cc:1209 0x1318f06 dump_context::dump_loc(dump_metadata_t const&, dump_user_location= _t const&) /repo/gcc-trunk/gcc/dumpfile.cc:601 0x1318f06 dump_context::dump_printf_loc_va(dump_metadata_t const&, dump_user_location_t const&, char const*, __va_list_tag (*) [1]) /repo/gcc-trunk/gcc/dumpfile.cc:1028 0x1318f06 dump_printf_loc(dump_metadata_t const&, dump_user_location_t cons= t&, char const*, ...) /repo/gcc-trunk/gcc/dumpfile.cc:1359 0x2b483d4 ipa_icf::sem_item_optimizer::merge_classes(unsigned int, unsigned int) /repo/gcc-trunk/gcc/ipa-icf.cc:3423 0x2b501f4 ipa_icf::sem_item_optimizer::execute() /repo/gcc-trunk/gcc/ipa-icf.cc:2484 0x2b53726 ipa_icf_driver /repo/gcc-trunk/gcc/ipa-icf.cc:3612 0x2b53726 ipa_icf::pass_ipa_icf::execute(function*) /repo/gcc-trunk/gcc/ipa-icf.cc:3659 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. I cannot reduce the testcase any more by cvise, as it fails to validate the initial input. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=3D/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-g= cc COLLECT_LTO_WRAPPER=3D/repo/gcc-trunk/binary-trunk-r14-9346-20240306205443-= g74e8cc28eda-checking-yes-rtl-df-extra-amd64/bin/../libexec/gcc/x86_64-pc-l= inux-gnu/14.0.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=3Dc,c++ --enable-valgrind-annotations --disable-nls --enable-checking=3Dyes,rtl,df,= extra --with-cloog --with-ppl --with-isl --build=3Dx86_64-pc-linux-gnu --host=3Dx86_64-pc-linux-gnu --target=3Dx86_64-pc-linux-gnu --with-ld=3D/usr/bin/x86_64-pc-linux-gnu-ld --with-as=3D/usr/bin/x86_64-pc-linux-gnu-as --enable-libsanitizer --disable-libstdcxx-pch --prefix=3D/repo/gcc-trunk//binary-trunk-r14-9346-20240306205443-g74e8cc28e= da-checking-yes-rtl-df-extra-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.1 20240306 (experimental) (GCC)=