-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Whee. The static checkers found another real bug. The
tree-ssa-forwprop.c fix eliminates a potential NULL pointer dereference
due to a typo in a condition. Basically if DEF_STMT is null, it would
be passed to can_propagate_from which would then dereference it.
Bootstrapped and regression tested on x86_64-unknown-linux-gnu. OK for
trunk?
Jeff
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/
iQEcBAEBAgAGBQJNlHnJAAoJEBRtltQi2kC7fFwH/13MwLl02m/xoFvk9T660jHk
gH82fngYkOho3E+hHlbOlahturVru0ti+B43XHvlZG0DhnCsci9YGn25cuSijv5i
vsRyRD9lKEfAlJk3N04aalbgLBZulHfKnn9vO8Lj7mBhezvd6mLz74AHW7dh68Ob
feZtQSnpW2gNqppl4JOkMcb79SUWsXGTFl0HAv9LGgtQwgzmh12VJ7i5meukzE0M
h4cFVU255INW7XrCPnA68r/oE6Bpy9xtl08VuyV7tTVejHz4msdrQV8e1bRWhCbP
O+lRI4lAfm3/8SceSdVwMUp/X5/MlBDrlnBX+wxG2imgYaMb735nZHcCVP/a2Kc=
=qyLX
-----END PGP SIGNATURE-----
* tree-ssa-forwprop.c (forward_propagate_into_cond): Avoid
typo potentially leading to null pointer dereference.
* caller-save.c (new_saved_hard_reg): Eliminate return value.
(setup_save_areas): Corresponding changes to avoid useless
assignments.
* jump.c (reversed_comparison_code_parts): Avoid successive return
statements when REVERSE_CONDITION is defined.
* expr.c (expand_assignment): Avoid useless assignments.
(expand_expr_real_1): Likewise.
(expand_expr_real_2): Avoid useless statements.
* tree-ssa-phiopt.c (minmax_replacement): Avoid useless statement.
* cfgexpand.c (expand_gimple_basic_block): Avoid useless assignment.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Avoid useless
statements.
* stmt.c (expand_expr_stmt): Avoid useless assignment.
Index: caller-save.c
===================================================================
*** caller-save.c (revision 171731)
--- caller-save.c (working copy)
*************** static int reg_restore_code (int, enum m
*** 82,88 ****
struct saved_hard_reg;
static void initiate_saved_hard_regs (void);
! static struct saved_hard_reg *new_saved_hard_reg (int, int);
static void finish_saved_hard_regs (void);
static int saved_hard_reg_compare_func (const void *, const void *);
--- 82,88 ----
struct saved_hard_reg;
static void initiate_saved_hard_regs (void);
! static void new_saved_hard_reg (int, int);
static void finish_saved_hard_regs (void);
static int saved_hard_reg_compare_func (const void *, const void *);
*************** initiate_saved_hard_regs (void)
*** 346,352 ****
/* Allocate and return new saved hard register with given REGNO and
CALL_FREQ. */
! static struct saved_hard_reg *
new_saved_hard_reg (int regno, int call_freq)
{
struct saved_hard_reg *saved_reg;
--- 346,352 ----
/* Allocate and return new saved hard register with given REGNO and
CALL_FREQ. */
! static void
new_saved_hard_reg (int regno, int call_freq)
{
struct saved_hard_reg *saved_reg;
*************** new_saved_hard_reg (int regno, int call_
*** 359,365 ****
saved_reg->call_freq = call_freq;
saved_reg->first_p = FALSE;
saved_reg->next = -1;
- return saved_reg;
}
/* Free memory allocated for the saved hard registers. */
--- 359,364 ----
*************** setup_save_areas (void)
*** 463,469 ****
if (hard_reg_map[regno] != NULL)
hard_reg_map[regno]->call_freq += freq;
else
! saved_reg = new_saved_hard_reg (regno, freq);
SET_HARD_REG_BIT (hard_regs_used, regno);
}
/* Look through all live pseudos, mark their hard registers. */
--- 462,468 ----
if (hard_reg_map[regno] != NULL)
hard_reg_map[regno]->call_freq += freq;
else
! new_saved_hard_reg (regno, freq);
SET_HARD_REG_BIT (hard_regs_used, regno);
}
/* Look through all live pseudos, mark their hard registers. */
*************** setup_save_areas (void)
*** 483,489 ****
if (hard_reg_map[r] != NULL)
hard_reg_map[r]->call_freq += freq;
else
! saved_reg = new_saved_hard_reg (r, freq);
SET_HARD_REG_BIT (hard_regs_to_save, r);
SET_HARD_REG_BIT (hard_regs_used, r);
}
--- 482,488 ----
if (hard_reg_map[r] != NULL)
hard_reg_map[r]->call_freq += freq;
else
! new_saved_hard_reg (r, freq);
SET_HARD_REG_BIT (hard_regs_to_save, r);
SET_HARD_REG_BIT (hard_regs_used, r);
}
Index: jump.c
===================================================================
*** jump.c (revision 171659)
--- jump.c (working copy)
*************** reversed_comparison_code_parts (enum rtx
*** 308,315 ****
{
#ifdef REVERSE_CONDITION
return REVERSE_CONDITION (code, mode);
! #endif
return reverse_condition (code);
}
/* Try a few special cases based on the comparison code. */
--- 308,316 ----
{
#ifdef REVERSE_CONDITION
return REVERSE_CONDITION (code, mode);
! #else
return reverse_condition (code);
+ #endif
}
/* Try a few special cases based on the comparison code. */
Index: expr.c
===================================================================
*** expr.c (revision 171659)
--- expr.c (working copy)
*************** expand_assignment (tree to, tree from, b
*** 4124,4130 ****
/* Don't crash if the lhs of the assignment was erroneous. */
if (TREE_CODE (to) == ERROR_MARK)
{
! result = expand_normal (from);
return;
}
--- 4124,4130 ----
/* Don't crash if the lhs of the assignment was erroneous. */
if (TREE_CODE (to) == ERROR_MARK)
{
! expand_normal (from);
return;
}
*************** expand_expr_real_2 (sepops ops, rtx targ
*** 8170,8176 ****
case VEC_UNPACK_LO_EXPR:
{
op0 = expand_normal (treeop0);
- this_optab = optab_for_tree_code (code, type, optab_default);
temp = expand_widen_pattern_expr (ops, op0, NULL_RTX, NULL_RTX,
target, unsignedp);
gcc_assert (temp);
--- 8170,8175 ----
*************** expand_expr_real_2 (sepops ops, rtx targ
*** 8182,8190 ****
{
op0 = expand_normal (treeop0);
/* The signedness is determined from input operand. */
- this_optab = optab_for_tree_code (code,
- TREE_TYPE (treeop0),
- optab_default);
temp = expand_widen_pattern_expr
(ops, op0, NULL_RTX, NULL_RTX,
target, TYPE_UNSIGNED (TREE_TYPE (treeop0)));
--- 8181,8186 ----
*************** expand_expr_real_1 (tree exp, rtx target
*** 8334,8340 ****
{
temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier);
if (MEM_P (temp))
! temp = copy_to_reg (temp);
return const0_rtx;
}
--- 8330,8336 ----
{
temp = expand_expr (exp, NULL_RTX, VOIDmode, modifier);
if (MEM_P (temp))
! copy_to_reg (temp);
return const0_rtx;
}
Index: tree-ssa-phiopt.c
===================================================================
*** tree-ssa-phiopt.c (revision 171659)
--- tree-ssa-phiopt.c (working copy)
*************** minmax_replacement (basic_block cond_bb,
*** 695,701 ****
cond = last_stmt (cond_bb);
cmp = gimple_cond_code (cond);
- result = PHI_RESULT (phi);
/* This transformation is only valid for order comparisons. Record which
operand is smaller/larger if the result of the comparison is true. */
--- 695,700 ----
Index: cfgexpand.c
===================================================================
*** cfgexpand.c (revision 171659)
--- cfgexpand.c (working copy)
*************** expand_gimple_basic_block (basic_block b
*** 3576,3582 ****
val = gen_rtx_VAR_LOCATION
(mode, var, (rtx)value, VAR_INIT_STATUS_INITIALIZED);
! val = emit_debug_insn (val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
--- 3576,3582 ----
val = gen_rtx_VAR_LOCATION
(mode, var, (rtx)value, VAR_INIT_STATUS_INITIALIZED);
! emit_debug_insn (val);
if (dump_file && (dump_flags & TDF_DETAILS))
{
Index: tree-ssa-forwprop.c
===================================================================
*** tree-ssa-forwprop.c (revision 171659)
--- tree-ssa-forwprop.c (working copy)
*************** forward_propagate_into_cond (gimple_stmt
*** 553,559 ****
{
name = cond;
def_stmt = get_prop_source_stmt (name, true, NULL);
! if (def_stmt || !can_propagate_from (def_stmt))
return did_something;
rhs0 = gimple_assign_rhs1 (def_stmt);
--- 553,559 ----
{
name = cond;
def_stmt = get_prop_source_stmt (name, true, NULL);
! if (!def_stmt || !can_propagate_from (def_stmt))
return did_something;
rhs0 = gimple_assign_rhs1 (def_stmt);
Index: tree-ssa-dce.c
===================================================================
*** tree-ssa-dce.c (revision 171659)
--- tree-ssa-dce.c (working copy)
*************** mark_operand_necessary (tree op)
*** 271,278 ****
static void
mark_stmt_if_obviously_necessary (gimple stmt, bool aggressive)
{
- tree lhs = NULL_TREE;
-
/* With non-call exceptions, we have to assume that all statements could
throw. If a statement may throw, it is inherently necessary. */
if (cfun->can_throw_non_call_exceptions && stmt_could_throw_p (stmt))
--- 271,276 ----
*************** mark_stmt_if_obviously_necessary (gimple
*** 311,322 ****
}
if (!gimple_call_lhs (stmt))
return;
- lhs = gimple_call_lhs (stmt);
- /* Fall through */
-
- case GIMPLE_ASSIGN:
- if (!lhs)
- lhs = gimple_assign_lhs (stmt);
break;
case GIMPLE_DEBUG:
--- 309,314 ----
Index: stmt.c
===================================================================
*** stmt.c (revision 171659)
--- stmt.c (working copy)
*************** expand_expr_stmt (tree exp)
*** 1455,1461 ****
if (TYPE_MODE (type) == VOIDmode)
;
else if (TYPE_MODE (type) != BLKmode)
! value = copy_to_reg (value);
else
{
rtx lab = gen_label_rtx ();
--- 1455,1461 ----
if (TYPE_MODE (type) == VOIDmode)
;
else if (TYPE_MODE (type) != BLKmode)
! copy_to_reg (value);
else
{
rtx lab = gen_label_rtx ();