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]

[PATCH] Fix part of PR58712


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.
Thanks.

2013-10-15  Markus Trippelsdorf  <markus@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


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