Commit 6ef6945c by Trevor Saunders Committed by Trevor Saunders

fix pr62009 use after free in redirect_edge_var_map_dup

The change to get the entry for the old edge before inserting the new
one was incorrect because if inserting the new one resized the table
then the pointer to the entry for the old one would become invalid.

gcc/

	* tree-ssa.c (redirect_edge_var_map_dup): insert newe before
	getting olde.

From-SVN: r213644
parent fa12e57e
2014-08-05 Trevor Saunders <tsaunders@mozilla.com>
* tree-ssa.c (redirect_edge_var_map_dup): insert newe before
getting olde.
2014-08-05 Richard Biener <rguenther@suse.de>
PR rtl-optimization/61672
......
......@@ -106,11 +106,12 @@ redirect_edge_var_map_dup (edge newe, edge olde)
if (!edge_var_maps)
return;
auto_vec<edge_var_map> *head = edge_var_maps->get (olde);
if (!head)
auto_vec<edge_var_map> *new_head = &edge_var_maps->get_or_insert (newe);
auto_vec<edge_var_map> *old_head = edge_var_maps->get (olde);
if (!old_head)
return;
edge_var_maps->get_or_insert (newe).safe_splice (*head);
new_head->safe_splice (*old_head);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment