https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95572
Bug ID: 95572 Summary: lto1: internal compiler error: in lto_input_tree_ref, at lto-streamer-in.c:370 Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: sujian.liu at huawei dot com CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 48700 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48700&action=edit Test case The version used by GCC is 7.3.0. Only under the O0 option, ICE will appear, and O1+ will not report an error. When I use the riscv compiler,the following ICE will be reported: riscv32-unknown-elf-gcc vla-16.c -lm -o ./vla-16.exe -flto In function 'f5': lto1: internal compiler error: in lto_input_tree_ref, at lto-streamer-in.c:370 0x55b22e6f8b48 ??? ../sysdeps/x86_64/start.S:108 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. lto-wrapper: fatal error: riscv32-unknown-elf-gcc returned 1 exit status compilation terminated. /home/lsj/0608/hcc_riscv32/bin/../lib/gcc/riscv32-unknown-elf/7.3.0/../../../../riscv32-unknown-elf/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status ============================================================================= When I use the x86_64-linux-gnu compiler,the following ICE will be reported: gcc vla-16.c -lm -o ./vla-16.exe -flto In function ‘f3’: lto1: internal compiler error: in lto_input_tree_ref, at lto-streamer-in.c:370 0x8431e8 lto_input_tree_ref(lto_input_block*, data_in*, function*, LTO_tags) ../../gcc/lto-streamer-in.c:370 0x84337d lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) ../../gcc/lto-streamer-in.c:1446 0x84363b lto_input_tree(lto_input_block*, data_in*) ../../gcc/lto-streamer-in.c:1492 0xaf96c5 lto_input_ts_exp_tree_pointers ../../gcc/tree-streamer-in.c:895 0xaf96c5 streamer_read_tree_body(lto_input_block*, data_in*, tree_node*) ../../gcc/tree-streamer-in.c:1081 0x842caf lto_read_tree_1 ../../gcc/lto-streamer-in.c:1333 0x8433c7 lto_read_tree ../../gcc/lto-streamer-in.c:1363 0x8433c7 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) ../../gcc/lto-streamer-in.c:1475 0x8435b2 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*) ../../gcc/lto-streamer-in.c:1387 0x843614 lto_input_tree(lto_input_block*, data_in*) ../../gcc/lto-streamer-in.c:1490 0x8443a9 input_struct_function_base ../../gcc/lto-streamer-in.c:987 0x8443a9 input_function ../../gcc/lto-streamer-in.c:1061 0x8443a9 lto_read_body_or_constructor ../../gcc/lto-streamer-in.c:1259 0x6213f4 cgraph_node::get_untransformed_body() ../../gcc/cgraph.c:3620 0x62b47e cgraph_node::expand() ../../gcc/cgraphunit.c:2012 0x62c0c7 output_in_order ../../gcc/cgraphunit.c:2285 0x62c4f3 symbol_table::compile() ../../gcc/cgraphunit.c:2530 0x5b8ac4 lto_main() ../../gcc/lto/lto.c:3334 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. lto-wrapper: fatal error: gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status Attachment provides the test case.