Commit 1eb7b049 by Dirk Mueller Committed by Dirk Mueller

re PR bootstrap/30511 (False array bound check causes gcc failed to boostrap)

2007-01-21  Dirk Mueller  <dmueller@suse.de>

        PR bootstrap/30511
        * tree-vrp.c (check_array_bounds): do not warn
        about ADDR_EXPR's of ARRAY_REF's which are immediately
        used in binary expressions.

From-SVN: r121032
parent e9e90c1f
2007-01-21 Dirk Mueller <dmueller@suse.de>
PR bootstrap/30511
* tree-vrp.c (check_array_bounds): do not warn
about ADDR_EXPR's of ARRAY_REF's which are immediately
used in binary expressions.
2007-01-21 Ira Rosen <irar@il.ibm.com> 2007-01-21 Ira Rosen <irar@il.ibm.com>
* tree-vectorizer.h (struct _stmt_vec_info): Add new field * tree-vectorizer.h (struct _stmt_vec_info): Add new field
......
...@@ -3564,7 +3564,8 @@ static tree ...@@ -3564,7 +3564,8 @@ static tree
check_array_bounds (tree *tp, int *walk_subtree, void *data) check_array_bounds (tree *tp, int *walk_subtree, void *data)
{ {
tree t = *tp; tree t = *tp;
location_t *location = EXPR_LOCUS ((tree) data); tree stmt = (tree)data;
location_t *location = EXPR_LOCUS (stmt);
*walk_subtree = TRUE; *walk_subtree = TRUE;
...@@ -3572,18 +3573,34 @@ check_array_bounds (tree *tp, int *walk_subtree, void *data) ...@@ -3572,18 +3573,34 @@ check_array_bounds (tree *tp, int *walk_subtree, void *data)
check_array_ref (t, location, false /*ignore_off_by_one*/); check_array_ref (t, location, false /*ignore_off_by_one*/);
else if (TREE_CODE (t) == ADDR_EXPR) else if (TREE_CODE (t) == ADDR_EXPR)
{ {
use_operand_p op;
tree use_stmt;
t = TREE_OPERAND (t, 0); t = TREE_OPERAND (t, 0);
/* Don't warn on statements like /* Don't warn on statements like
ssa_name = 500 + &array[-200] which are sometimes
produced by various optimizing passes. */ ssa_name = 500 + &array[-200]
if (TREE_CODE ((tree)data) == GIMPLE_MODIFY_STMT
&& BINARY_CLASS_P (GIMPLE_STMT_OPERAND ((tree)data, 1))) or
{
*walk_subtree = FALSE; ssa_name = &array[-200]
return NULL_TREE; other_name = ssa_name + 300;
}
while (handled_component_p (t)) which are sometimes
produced by other optimizing passes. */
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& BINARY_CLASS_P (GIMPLE_STMT_OPERAND (stmt, 1)))
*walk_subtree = FALSE;
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == SSA_NAME
&& single_imm_use (GIMPLE_STMT_OPERAND (stmt, 0), &op, &use_stmt)
&& TREE_CODE (use_stmt) == GIMPLE_MODIFY_STMT
&& BINARY_CLASS_P (GIMPLE_STMT_OPERAND (use_stmt, 1)))
*walk_subtree = FALSE;
while (*walk_subtree && handled_component_p (t))
{ {
if (TREE_CODE (t) == ARRAY_REF) if (TREE_CODE (t) == ARRAY_REF)
check_array_ref (t, location, true /*ignore_off_by_one*/); check_array_ref (t, location, true /*ignore_off_by_one*/);
......
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