Hi, I was having a look at PR69133. It appears that with -flto-partition=none, cgraph_node::get_untransformed_body () is called twice for node with asm_name _ZThn4_N11xercesc_3_11C5m_fn6ERKi. c++filt says it is: non-virtual thunk to xercesc_3_1::C::m_fn6(int const&)
get_untransformed_body() calls lto_free_function_in_decl_state_for_node() which sets node->lto_file_data to NULL. Now 2nd time get_untransformed_body is called for the same node, node->lto_file_data is NULL and lto_get_decl_name_mapping() dereferences lto_file_data which results in segfault. I was wondering if gating on lto_file_data could be a reasonable solution ? if (!lto_file_data) return false; I am not sure what value to return for this case (I chose false because of early exit). It prevents the ICE, and the patch passes bootstrap+test on x86_64-unknown-linux-gnu. With partitoning enabled, for the above test-case, get_untransformed_body () is called only once per node. However I don't understand why it gets called twice with -flto-partition=none. Thank you, Prathamesh
diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 0d70904..3bda0e7 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3310,6 +3310,9 @@ cgraph_node::get_untransformed_body (void) gcc_assert (in_lto_p); + if (!lto_file_data) + return false; + timevar_push (TV_IPA_LTO_GIMPLE_IN); file_data = lto_file_data;