summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiprop.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-21 09:58:38 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-04-21 09:58:38 +0000
commit80a26b8bdf415b234e3473f14741e11f3153c36c (patch)
treecbdfe606ec1263a4ac53cb6b346f189d4825f041 /gcc/tree-ssa-phiprop.c
parent8734914d0ac18069cb2341a8c1a98dad6c10b323 (diff)
downloadgcc-80a26b8bdf415b234e3473f14741e11f3153c36c.tar.gz
2009-04-21 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39827 * tree-ssa-phiprop.c (propagate_with_phi): Check SSA_NAME is in range. (tree_ssa_phiprop): Pass the correct array size. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@146515 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-phiprop.c')
-rw-r--r--gcc/tree-ssa-phiprop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-ssa-phiprop.c b/gcc/tree-ssa-phiprop.c
index f608f1d056e..4e6e09c477d 100644
--- a/gcc/tree-ssa-phiprop.c
+++ b/gcc/tree-ssa-phiprop.c
@@ -253,6 +253,7 @@ propagate_with_phi (basic_block bb, gimple phi, struct phiprop_d *phivn,
/* Avoid to have to decay *&a to a[0] later. */
|| !is_gimple_reg_type (TREE_TYPE (TREE_OPERAND (arg, 0))))
&& !(TREE_CODE (arg) == SSA_NAME
+ && SSA_NAME_VERSION (arg) < n
&& phivn[SSA_NAME_VERSION (arg)].value != NULL_TREE
&& phivn_valid_p (phivn, arg, bb)))
return false;
@@ -336,18 +337,19 @@ tree_ssa_phiprop (void)
basic_block bb;
gimple_stmt_iterator gsi;
unsigned i;
+ size_t n;
calculate_dominance_info (CDI_DOMINATORS);
- phivn = XCNEWVEC (struct phiprop_d, num_ssa_names);
+ n = num_ssa_names;
+ phivn = XCNEWVEC (struct phiprop_d, n);
/* Walk the dominator tree in preorder. */
bbs = get_all_dominated_blocks (CDI_DOMINATORS,
single_succ (ENTRY_BLOCK_PTR));
for (i = 0; VEC_iterate (basic_block, bbs, i, bb); ++i)
for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi))
- did_something |= propagate_with_phi (bb, gsi_stmt (gsi),
- phivn, num_ssa_names);
+ did_something |= propagate_with_phi (bb, gsi_stmt (gsi), phivn, n);
if (did_something)
gsi_commit_edge_inserts ();