This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix part of PR58712


> On Fri, Oct 18, 2013 at 12:10 PM, Markus Trippelsdorf
> <markus@trippelsdorf.de> wrote:
> > On 2013.10.15 at 12:49 +0200, Richard Biener wrote:
> >> On Tue, Oct 15, 2013 at 12:31 PM, Markus Trippelsdorf
> >> <markus@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?
> >
> > IOW something like this:
> 
> Looks good to me.
> 
> Honza?

Yes, this is OK.
Thanks!
Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]