diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f7565153e241..b110b8ef50b8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-11-04 Kazu Hirata + + * tree-cfg.c (find_taken_edge): Reject VAL begin NULL. + * tree-ssa-ccp.c (visit_cond_stmt): Don't call find_taken_edge + with VAL being NULL. + 2004-11-04 Kazu Hirata * cfghooks.c (delete_basic_block): Remove code to truncate diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 3c8a505815fd..67b96a5737de 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1954,15 +1954,16 @@ find_taken_edge (basic_block bb, tree val) gcc_assert (stmt); gcc_assert (is_ctrl_stmt (stmt)); + gcc_assert (val); /* If VAL is a predicate of the form N RELOP N, where N is an SSA_NAME, we can usually determine its truth value. */ - if (val && COMPARISON_CLASS_P (val)) + if (COMPARISON_CLASS_P (val)) val = fold (val); /* If VAL is not a constant, we can't determine which edge might be taken. */ - if (val == NULL || !really_constant_p (val)) + if (!really_constant_p (val)) return NULL; if (TREE_CODE (stmt) == COND_EXPR) diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index b97424f02e26..42094805b41b 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -1123,7 +1123,7 @@ visit_cond_stmt (tree stmt, edge *taken_edge_p) to the worklist. If no single edge can be determined statically, return SSA_PROP_VARYING to feed all the outgoing edges to the propagation engine. */ - *taken_edge_p = find_taken_edge (block, val.const_val); + *taken_edge_p = val.const_val ? find_taken_edge (block, val.const_val) : 0; if (*taken_edge_p) return SSA_PROP_INTERESTING; else