summaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-07 16:14:02 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-07 16:14:02 +0000
commit2727c872254d6a1e35844fd927057a26c2de3be4 (patch)
treedb0482ed39bfbaeb0587c8d44b2175b07d0fdb8f /gcc/tree-cfg.c
parent35cc69f61752fc3463640a52cd6372b1b792213d (diff)
downloadgcc-2727c872254d6a1e35844fd927057a26c2de3be4.tar.gz
2010-01-07 Richard Guenther <rguenther@suse.de>
* gimple.h (gss_for_code): Wrap gcc_assert in ENABLE_CHECKING. (gimple_op): Likewise. (gimple_op_ptr): Likewise. (gimple_assign_set_lhs): Remove gcc_assert. (gimple_assign_set_rhs1): Likewise. (gimple_assign_set_rhs2): Likewise. (gimple_call_set_lhs): Likewise. (gimple_call_set_fn): Likewise. (gimple_call_set_fndecl): Likewise. (gimple_call_fndecl): Likewise. (gimple_call_return_type): Likewise. (gimple_call_set_chain): Likewise. (gimple_call_num_args): Likewise. (gimple_call_set_arg): Likewise. (gimple_cond_set_code): Likewise. (gimple_cond_set_lhs): Likewise. (gimple_cond_set_rhs): Likewise. (gimple_cond_set_true_label): Likewise. (gimple_cond_set_false_label): Likewise. (gimple_label_set_label): Likewise. (gimple_goto_set_dest): Likewise. (gimple_debug_bind_get_var): Wrap gcc_assert in ENABLE_CHECKING. (gimple_debug_bind_get_value): Likewise. (gimple_debug_bind_get_value_ptr): Likewise. (gimple_debug_bind_set_var): Likewise. (gimple_debug_bind_set_value): Likewise. (gimple_debug_bind_reset_value): Likewise. (gimple_debug_bind_has_value_p): Likewise. (gimple_return_retval_ptr): Remove gcc_assert. (gimple_return_retval): Likewise. (gimple_return_set_retval): Likewise. * tree-flow.h (struct gimple_df): Remove nonlocal_all member. (safe_referenced_var_iterator): Remove. (FOR_EACH_REFERENCED_VAR_SAFE): Likewise. * tree-flow-inline.h (gimple_nonlocal_all): Remove. (fill_referenced_var_vec): Remove. (first_readonly_imm_use): Remove redundant gcc_assert. (phi_arg_index_from_use): Combine gcc_asserts. (move_use_after_head): Wrap gcc_assert in ENABLE_CHECKING. (first_imm_use_stmt): Remove redundant gcc_assert. * tree-cfg.c (verify_gimple_call): Verify function and chain operands. Verify arguments. (verify_types_in_gimple_stmt): Verify condition code and labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155696 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c43
1 files changed, 42 insertions, 1 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 2eb3cd2d79c..36e518c9882 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -2937,6 +2937,15 @@ verify_gimple_call (gimple stmt)
{
tree fn = gimple_call_fn (stmt);
tree fntype;
+ unsigned i;
+
+ if (TREE_CODE (fn) != OBJ_TYPE_REF
+ && !is_gimple_val (fn))
+ {
+ error ("invalid function in gimple call");
+ debug_generic_stmt (fn);
+ return true;
+ }
if (!POINTER_TYPE_P (TREE_TYPE (fn))
|| (TREE_CODE (TREE_TYPE (TREE_TYPE (fn))) != FUNCTION_TYPE
@@ -2972,6 +2981,14 @@ verify_gimple_call (gimple stmt)
return true;
}
+ if (gimple_call_chain (stmt)
+ && !is_gimple_val (gimple_call_chain (stmt)))
+ {
+ error ("invalid static chain in gimple call");
+ debug_generic_stmt (gimple_call_chain (stmt));
+ return true;
+ }
+
/* If there is a static chain argument, this should not be an indirect
call, and the decl should have DECL_STATIC_CHAIN set. */
if (gimple_call_chain (stmt))
@@ -2993,9 +3010,19 @@ verify_gimple_call (gimple stmt)
/* ??? The C frontend passes unpromoted arguments in case it
didn't see a function declaration before the call. So for now
- leave the call arguments unverified. Once we gimplify
+ leave the call arguments mostly unverified. Once we gimplify
unit-at-a-time we have a chance to fix this. */
+ for (i = 0; i < gimple_call_num_args (stmt); ++i)
+ {
+ tree arg = gimple_call_arg (stmt, i);
+ if (!is_gimple_operand (arg))
+ {
+ error ("invalid argument to gimple call");
+ debug_generic_expr (arg);
+ }
+ }
+
return false;
}
@@ -3744,6 +3771,20 @@ verify_types_in_gimple_stmt (gimple stmt)
return verify_gimple_call (stmt);
case GIMPLE_COND:
+ if (TREE_CODE_CLASS (gimple_cond_code (stmt)) != tcc_comparison)
+ {
+ error ("invalid comparison code in gimple cond");
+ return true;
+ }
+ if (!(!gimple_cond_true_label (stmt)
+ || TREE_CODE (gimple_cond_true_label (stmt)) == LABEL_DECL)
+ || !(!gimple_cond_false_label (stmt)
+ || TREE_CODE (gimple_cond_false_label (stmt)) == LABEL_DECL))
+ {
+ error ("invalid labels in gimple cond");
+ return true;
+ }
+
return verify_gimple_comparison (boolean_type_node,
gimple_cond_lhs (stmt),
gimple_cond_rhs (stmt));