On Tue, Oct 15, 2013 at 12:31 PM, Markus Trippelsdorf <mar...@trippelsdorf.de> wrote: > Valgrind complains: > ==27870== Conditional jump or move depends on uninitialised value(s) > ==27870== at 0x557CDC: cgraph_create_edge_1(cgraph_node*, cgraph_node*, > gimple_statement_d*, long, int) (cgraph.c:695) > ==27870== by 0x55882E: cgraph_create_edge(cgraph_node*, cgraph_node*, > gimple_statement_d*, long, int) (cgraph.c:890) > ==27870== by 0x560891: cgraph_clone_edge(cgraph_edge*, cgraph_node*, > gimple_statement_d*, unsigned int, long, int, bool) (cgraphclones.c:135) > ==27870== by 0x7F1F14: copy_body(copy_body_data*, long, int, > basic_block_def*, basic_block_def*, basic_block_def*) (tree-inline.c:1741) > ... > ==27870== Uninitialised value was created by a client request > ==27870== at 0x50BBEE: ggc_internal_alloc_stat(unsigned long) > (ggc-page.c:1339) > ==27870== by 0x557D92: cgraph_create_edge_1(cgraph_node*, cgraph_node*, > gimple_statement_d*, long, int) (cgraph.c:842) > ==27870== by 0x55882E: cgraph_create_edge(cgraph_node*, cgraph_node*, > gimple_statement_d*, long, int) (cgraph.c:890) > ==27870== by 0x560891: cgraph_clone_edge(cgraph_edge*, cgraph_node*, > gimple_statement_d*, unsigned int, long, int, bool) (cgraphclones.c:135) > ,,, > > This happens because e->indirect_unknown_callee may be uninitialized in > cgraph_add_edge_to_call_site_hash. Fixed by initializing it earlier. > > LTO bootstrapped and tested on x86_64-unknown-linux-gnu. > > Please apply, if this looks reasonable.
As we also have struct cgraph_edge * cgraph_create_indirect_edge (struct cgraph_node *caller, gimple call_stmt, int ecf_flags, gcov_type count, int freq) { struct cgraph_edge *edge = cgraph_create_edge_1 (caller, NULL, call_stmt, count, freq); tree target; edge->indirect_unknown_callee = 1; I'd rather change the cgraph_create_edge_1 interface to get an additional argument (the value to use for indirect_unknown_callee). Or maybe we can statically compute it from the current arguments already? Honza? Thanks, Richard. > Thanks. > > 2013-10-15 Markus Trippelsdorf <mar...@trippelsdorf.de> > > PR ipa/58712 > * cgraph.c (cgraph_create_edge_1): Initialize > indirect_unknown_callee earlier. > (cgraph_create_edge): Likewise. > > diff --git a/gcc/cgraph.c b/gcc/cgraph.c > index 124ee0adf855..c5c4e13ba145 100644 > --- a/gcc/cgraph.c > +++ b/gcc/cgraph.c > @@ -874,6 +874,7 @@ cgraph_create_edge_1 (struct cgraph_node *caller, struct > cgraph_node *callee, > edge->indirect_info = NULL; > edge->indirect_inlining_edge = 0; > edge->speculative = false; > + edge->indirect_unknown_callee = 0; > if (call_stmt && caller->call_site_hash) > cgraph_add_edge_to_call_site_hash (edge); > > @@ -889,7 +890,6 @@ cgraph_create_edge (struct cgraph_node *caller, struct > cgraph_node *callee, > struct cgraph_edge *edge = cgraph_create_edge_1 (caller, callee, call_stmt, > count, freq); > > - edge->indirect_unknown_callee = 0; > initialize_inline_failed (edge); > > edge->next_caller = callee->callers; > -- > Markus