Re: Fix more minor issues from static checkers

2011-03-24 Thread Diego Novillo
On Thu, Mar 24, 2011 at 10:37, Jeff Law  wrote:

> Bootstrapped and regression tested on x86_64-unknown-linux-gnu.  OK for
> trunk?

OK.


Diego.


Fix more minor issues from static checkers

2011-03-24 Thread Jeff Law
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


First in tree-ssa-live.c, "ann" is set, but never used in a couple places.

Second, in tree-ssa-copy.c we set "stmt" in
propagate_tree_value_into_stmt, but never use it.  Removing the
assignment is obviously trivial.

Finally, in cfglayout force_nonfallthru may delete its argument (E_FALL)
which we then use.  The fix is to save E_FALL->src prior to the call to
force_nonfallthru.

Bootstrapped and regression tested on x86_64-unknown-linux-gnu.  OK for
trunk?

Thanks,
Jeff
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNi1dDAAoJEBRtltQi2kC7b8kIAIsiwpn3FieHNWhn5RGFdn85
mXoknFh9Ybc71XOKU80UAWCxX61iCImJoqKJNdAEi1S4KLRboKIzEv2OrNjNbt4r
c8EO8K8Q42NJ3IcinbHuqWK9KxhRuWso2w4VEMVS8gOHgSl12PA2C2LYMWLXa0l5
EgNNta6HWCD1uC8EL7Zt+3vMLRY7Ru+bVbR1T58miRe9CatK5Iz85T3FZ0qfPr4z
Lp8aHCPcRQlabqgk2Thr/cexK3ZdTFXdHP+F3e60GlPEB7Y0nbwrZIvHW+RWj2z0
Et4wEEUnrCXbqJMaZgrHaOl5lierXKMy2FPc/tMSrUO6kw920Y8PzNMQweP4QSE=
=cYgV
-END PGP SIGNATURE-
* tree-ssa-live.c (remove_unused_scope_block_p): Remove set but
unused variable "ann".
(remove_unused_locals): Likewise.

* tree-ssa-copy.c (propagate_tree_value_into_stmt): Remove useless
statement.

* cfglayout.c (fixup_reorder_chain): Do not dereference E_FALL
after it is freed.

Index: tree-ssa-live.c
===
*** tree-ssa-live.c (revision 171351)
--- tree-ssa-live.c (working copy)
*** remove_unused_scope_block_p (tree scope)
*** 427,433 
  {
tree *t, *next;
bool unused = !TREE_USED (scope);
-   var_ann_t ann;
int nsubblocks = 0;
  
for (t = &BLOCK_VARS (scope); *t; t = next)
--- 427,432 
*** remove_unused_scope_block_p (tree scope)
*** 467,474 
 info about optimized-out variables in the scope blocks.
 Exception are the scope blocks not containing any instructions
 at all so user can't get into the scopes at first place.  */
!   else if ((ann = var_ann (*t)) != NULL
!  && is_used_p (*t))
unused = false;
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
/* For labels that are still used in the IL, the decision to
--- 466,472 
 info about optimized-out variables in the scope blocks.
 Exception are the scope blocks not containing any instructions
 at all so user can't get into the scopes at first place.  */
!   else if (var_ann (*t) != NULL && is_used_p (*t))
unused = false;
else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
/* For labels that are still used in the IL, the decision to
*** remove_unused_locals (void)
*** 690,696 
basic_block bb;
tree var, t;
referenced_var_iterator rvi;
-   var_ann_t ann;
bitmap global_unused_vars = NULL;
unsigned srcidx, dstidx, num;
  
--- 688,693 
*** remove_unused_locals (void)
*** 766,772 
  {
var = VEC_index (tree, cfun->local_decls, srcidx);
if (TREE_CODE (var) != FUNCTION_DECL
! && (!(ann = var_ann (var))
  || !is_used_p (var)))
{
  if (is_global_var (var))
--- 763,769 
  {
var = VEC_index (tree, cfun->local_decls, srcidx);
if (TREE_CODE (var) != FUNCTION_DECL
! && (!var_ann (var)
  || !is_used_p (var)))
{
  if (is_global_var (var))
*** remove_unused_locals (void)
*** 798,804 
FOR_EACH_LOCAL_DECL (cfun, ix, var)
if (TREE_CODE (var) == VAR_DECL
&& is_global_var (var)
!   && (ann = var_ann (var)) != NULL
&& is_used_p (var))
  mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars);
  
--- 795,801 
FOR_EACH_LOCAL_DECL (cfun, ix, var)
if (TREE_CODE (var) == VAR_DECL
&& is_global_var (var)
!   && var_ann (var) != NULL
&& is_used_p (var))
  mark_all_vars_used (&DECL_INITIAL (var), global_unused_vars);
  
Index: tree-ssa-copy.c
===
*** tree-ssa-copy.c (revision 171351)
--- tree-ssa-copy.c (working copy)
*** propagate_tree_value_into_stmt (gimple_s
*** 244,250 
  expr = gimple_assign_rhs1 (stmt);
propagate_tree_value (&expr, val);
gimple_assign_set_rhs_from_tree (gsi, expr);
-   stmt = gsi_stmt (*gsi);
  }
else if (gimple_code (stmt) == GIMPLE_COND)
  {
--- 244,249 
Index: cfglayout.c
===
*** cfglayout.c (revision 171351)
--- cfglayout.c (working copy)
*** fixup_reorder_chain (void)
*** 766,772 
  {
edge e_fall, e_taken, e;
rtx bb_end_insn;
!   basic_block nb;
edge_iterato