https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111960
Bug ID: 111960 Summary: ICE: during GIMPLE pass: rebuild_frequencies: SIGSEGV (Invalid read of size 4) with -fdump-tree-rebuild_frequencies-all Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: tree-optimization 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 56189 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56189&action=edit reduced testcase Compiler output: $ x86_64-pc-linux-gnu-gcc -O --param=max-inline-recursive-depth=1000000 -fdump-tree-rebuild_frequencies-all -wrapper valgrind,-q,--num-callers=100 testcase.C ==13679== Invalid read of size 4 ==13679== at 0x4E7AF1A: fwrite (in /lib64/libc.so.6) ==13679== by 0x26E3D0E: dump_bb_info(_IO_FILE*, basic_block_def*, int, dump_flag, bool, bool) (cfg.cc:815) ==13679== by 0x1257DD7: dump_bb(_IO_FILE*, basic_block_def*, int, dump_flag) (cfghooks.cc:302) ==13679== by 0x17FA372: dump_function_to_file(tree_node*, _IO_FILE*, dump_flag) (tree-cfg.cc:8431) ==13679== by 0x1680652: execute_function_dump(function*, void*) [clone .part.0] (passes.cc:1797) ==13679== by 0x1683CC0: execute_one_pass(opt_pass*) (passes.cc:2717) ==13679== by 0x168412F: execute_pass_list_1(opt_pass*) (passes.cc:2750) ==13679== by 0x1684141: execute_pass_list_1(opt_pass*) (passes.cc:2751) ==13679== by 0x1684168: execute_pass_list(function*, opt_pass*) (passes.cc:2761) ==13679== by 0x1295665: expand (cgraphunit.cc:1841) ==13679== by 0x1295665: cgraph_node::expand() (cgraphunit.cc:1794) ==13679== by 0x12969AA: expand_all_functions (cgraphunit.cc:2024) ==13679== by 0x12969AA: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2398) ==13679== by 0x1299517: compile (cgraphunit.cc:2311) ==13679== by 0x1299517: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2583) ==13679== by 0x17BC4E1: compile_file() (toplev.cc:471) ==13679== by 0xEAB049: do_compile (toplev.cc:2126) ==13679== by 0xEAB049: toplev::main(int, char**) (toplev.cc:2282) ==13679== by 0xEAC7CA: main (main.cc:39) ==13679== Address 0x2930303030 is not stack'd, malloc'd or (recently) free'd ==13679== during GIMPLE pass: rebuild_frequencies dump file: a-testcase.C.108t.rebuild_frequencies1 ==13679== ==13679== Process terminating with default action of signal 11 (SIGSEGV) ==13679== Access not within mapped region at address 0x2930303030 ==13679== at 0x4E7AF1A: fwrite (in /lib64/libc.so.6) ==13679== by 0x26E3D0E: dump_bb_info(_IO_FILE*, basic_block_def*, int, dump_flag, bool, bool) (cfg.cc:815) ==13679== by 0x1257DD7: dump_bb(_IO_FILE*, basic_block_def*, int, dump_flag) (cfghooks.cc:302) ==13679== by 0x17FA372: dump_function_to_file(tree_node*, _IO_FILE*, dump_flag) (tree-cfg.cc:8431) ==13679== by 0x1680652: execute_function_dump(function*, void*) [clone .part.0] (passes.cc:1797) ==13679== by 0x16825EB: execute_function_dump (passes.cc:1792) ==13679== by 0x16825EB: emergency_dump_function() (passes.cc:1839) ==13679== by 0x2C07B9E: diagnostic_report_diagnostic(diagnostic_context*, diagnostic_info*) (diagnostic.cc:1563) ==13679== by 0x2C08392: diagnostic_impl(rich_location*, diagnostic_metadata const*, int, char const*, __va_list_tag (*) [1], diagnostic_t) (diagnostic.cc:1738) ==13679== by 0x2C090F6: internal_error(char const*, ...) (diagnostic.cc:2184) ==13679== by 0x17BBFFF: crash_signal(int) (toplev.cc:314) ==13679== by 0x4E4358F: ??? (in /lib64/libc.so.6) ==13679== by 0x4E7AF19: fwrite (in /lib64/libc.so.6) ==13679== by 0x26E3D0E: dump_bb_info(_IO_FILE*, basic_block_def*, int, dump_flag, bool, bool) (cfg.cc:815) ==13679== by 0x1257DD7: dump_bb(_IO_FILE*, basic_block_def*, int, dump_flag) (cfghooks.cc:302) ==13679== by 0x17FA372: dump_function_to_file(tree_node*, _IO_FILE*, dump_flag) (tree-cfg.cc:8431) ==13679== by 0x1680652: execute_function_dump(function*, void*) [clone .part.0] (passes.cc:1797) ==13679== by 0x1683CC0: execute_one_pass(opt_pass*) (passes.cc:2717) ==13679== by 0x168412F: execute_pass_list_1(opt_pass*) (passes.cc:2750) ==13679== by 0x1684141: execute_pass_list_1(opt_pass*) (passes.cc:2751) ==13679== by 0x1684168: execute_pass_list(function*, opt_pass*) (passes.cc:2761) ==13679== by 0x1295665: expand (cgraphunit.cc:1841) ==13679== by 0x1295665: cgraph_node::expand() (cgraphunit.cc:1794) ==13679== by 0x12969AA: expand_all_functions (cgraphunit.cc:2024) ==13679== by 0x12969AA: symbol_table::compile() [clone .part.0] (cgraphunit.cc:2398) ==13679== by 0x1299517: compile (cgraphunit.cc:2311) ==13679== by 0x1299517: symbol_table::finalize_compilation_unit() (cgraphunit.cc:2583) ==13679== by 0x17BC4E1: compile_file() (toplev.cc:471) ==13679== by 0xEAB049: do_compile (toplev.cc:2126) ==13679== by 0xEAB049: toplev::main(int, char**) (toplev.cc:2282) ==13679== by 0xEAC7CA: main (main.cc:39) ==13679== If you believe this happened as a result of a stack ==13679== overflow in your program's main thread (unlikely but ==13679== possible), you can try to increase the size of the ==13679== main thread stack using the --main-stacksize= flag. ==13679== The main thread stack size used in this run was 16777216. x86_64-pc-linux-gnu-gcc: internal compiler error: Segmentation fault signal terminated program valgrind Please submit a full bug report, with preprocessed source (by using -freport-bug). See <https://gcc.gnu.org/bugs/> for instructions. $ x86_64-pc-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=/repo/gcc-trunk/binary-latest-amd64/bin/x86_64-pc-linux-gnu-gcc COLLECT_LTO_WRAPPER=/repo/gcc-trunk/binary-trunk-r14-4866-20231023153002-g458db9b6149-checking-yes-rtl-df-extra-nobootstrap-amd64/bin/../libexec/gcc/x86_64-pc-linux-gnu/14.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /repo/gcc-trunk//configure --enable-languages=c,c++ --enable-valgrind-annotations --disable-nls --enable-checking=yes,rtl,df,extra --disable-bootstrap --with-cloog --with-ppl --with-isl --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --target=x86_64-pc-linux-gnu --with-ld=/usr/bin/x86_64-pc-linux-gnu-ld --with-as=/usr/bin/x86_64-pc-linux-gnu-as --disable-libstdcxx-pch --prefix=/repo/gcc-trunk//binary-trunk-r14-4866-20231023153002-g458db9b6149-checking-yes-rtl-df-extra-nobootstrap-amd64 Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 14.0.0 20231023 (experimental) (GCC)