aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfgcleanup.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2005-12-20 14:47:07 +0000
committerKazu Hirata <kazu@gcc.gnu.org>2005-12-20 14:47:07 +0000
commit338b5886eaf654b03dd59f66c888f1cf6f9f47db (patch)
treef4ca00ba23ba711cd266b66efd44af31919b3ed3 /gcc/tree-cfgcleanup.c
parentbd989e4c102a3e390825e8256f45ac56c5262650 (diff)
downloadgcc-338b5886eaf654b03dd59f66c888f1cf6f9f47db.zip
gcc-338b5886eaf654b03dd59f66c888f1cf6f9f47db.tar.gz
gcc-338b5886eaf654b03dd59f66c888f1cf6f9f47db.tar.bz2
re PR tree-optimization/25501 (Segfault)
gcc/ PR tree-optimization/25501 * tree-cfgcleanup.c (merge_phi_nodes): Check that RESULT is used in the PHI argument corresponding to the edge from BB to DEST. gcc/testsuite/ PR tree-optimization/25501 * testsuite/gcc.dg/tree-ssa/pr25501.c: New. From-SVN: r108853
Diffstat (limited to 'gcc/tree-cfgcleanup.c')
-rw-r--r--gcc/tree-cfgcleanup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c
index 6f8b1c0..836a14d 100644
--- a/gcc/tree-cfgcleanup.c
+++ b/gcc/tree-cfgcleanup.c
@@ -746,6 +746,7 @@ merge_phi_nodes (void)
else
{
tree phi;
+ unsigned int dest_idx = single_succ_edge (bb)->dest_idx;
/* BB dominates DEST. There may be many users of the PHI
nodes in BB. However, there is still a trivial case we
@@ -767,7 +768,8 @@ merge_phi_nodes (void)
/* Get the single use of the result of this PHI node. */
if (!single_imm_use (result, &imm_use, &use_stmt)
|| TREE_CODE (use_stmt) != PHI_NODE
- || bb_for_stmt (use_stmt) != dest)
+ || bb_for_stmt (use_stmt) != dest
+ || PHI_ARG_DEF (use_stmt, dest_idx) != result)
break;
}