https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67452
Bug ID: 67452 Summary: LTO ICE with -fopenmp-simd Product: gcc Version: 5.2.1 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: middle-end Assignee: jakub at gcc dot gnu.org Reporter: jakub at gcc dot gnu.org CC: hubicka at gcc dot gnu.org, rguenth at gcc dot gnu.org Target Milestone: --- On the gomp-4_1-branch the libgomp.c/for-5.c and libgomp.c++/for-13.C testcases ICE with intelmic emul offloading, I've reduced it down to -O2 -fopenmp-simd -flto on the following testcase: float b[3][3]; __attribute__((used, noinline)) void foo () { int v1, v2; #pragma omp simd collapse(2) for (v1 = 0; v1 < 3; v1++) for (v2 = 0; v2 < 3; v2++) b[v1][v2] = 2.5; } int main () { asm volatile ("" : : "r" (b) : "memory"); foo (); asm volatile ("" : : "r" (b) : "memory"); return 0; } The ICE is: In function ‘foo’: lto1: internal compiler error: in operator[], at vec.h:714 0x73a7a4 vec<tree_node*, va_heap, vl_embed>::operator[](unsigned int) ../../gcc/vec.h:714 0x73949c vec<tree_node*, va_heap, vl_ptr>::operator[](unsigned int) ../../gcc/vec.h:1180 0xedf193 streamer_tree_cache_get_tree ../../gcc/tree-streamer.h:111 0xee3487 streamer_get_pickled_tree(lto_input_block*, data_in*) ../../gcc/tree-streamer-in.c:1105 0xae9d42 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) ../../gcc/lto-streamer-in.c:1428 0xae9f7b lto_input_tree(lto_input_block*, data_in*) ../../gcc/lto-streamer-in.c:1474 0xee1da5 lto_input_ts_decl_minimal_tree_pointers ../../gcc/tree-streamer-in.c:689 0xee31c4 streamer_read_tree_body(lto_input_block*, data_in*, tree_node*) ../../gcc/tree-streamer-in.c:1046 0xae99b2 lto_read_tree_1 ../../gcc/lto-streamer-in.c:1304 0xae9abd lto_read_tree ../../gcc/lto-streamer-in.c:1338 0xae9f12 lto_input_tree_1(lto_input_block*, data_in*, LTO_tags, unsigned int) ../../gcc/lto-streamer-in.c:1457 0xae9b37 lto_input_scc(lto_input_block*, data_in*, unsigned int*, unsigned int*) ../../gcc/lto-streamer-in.c:1362 0xae9f61 lto_input_tree(lto_input_block*, data_in*) ../../gcc/lto-streamer-in.c:1472 0xae828a input_cfg ../../gcc/lto-streamer-in.c:863 0xae8e71 input_function ../../gcc/lto-streamer-in.c:1079 0xae9683 lto_read_body_or_constructor ../../gcc/lto-streamer-in.c:1232 0xae993c lto_input_function_body(lto_file_decl_data*, cgraph_node*, char const*) ../../gcc/lto-streamer-in.c:1278 0x7f4d60 cgraph_node::get_untransformed_body() ../../gcc/cgraph.c:3286 0x800c84 cgraph_node::expand() ../../gcc/cgraphunit.c:1892 0x801395 expand_all_functions ../../gcc/cgraphunit.c:2056 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. lto-wrapper: fatal error: ./xgcc returned 1 exit status compilation terminated. /usr/bin/ld: lto-wrapper failed collect2: error: ld returned 1 exit status The problem is that early optimizations eliminate simduid.3 uses and during release_ssa pass it is removed from cfun->local_decls, but remains in loop->simduid, and the LTO streaming doesn't expect to have trees streamed too late (during output_cfg) apparently.