aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-dse.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-01-26 09:52:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-01-26 09:52:48 +0000
commitdc874b53e5529e2a76d610500345e1f469366346 (patch)
tree54ab4727fc6dda034e3318ddcd386ab97f5de48c /gcc/tree-ssa-dse.c
parent20d4bdcbb1d88647bb05f54d1fdce955e49c25d7 (diff)
downloadgcc-dc874b53e5529e2a76d610500345e1f469366346.zip
gcc-dc874b53e5529e2a76d610500345e1f469366346.tar.gz
gcc-dc874b53e5529e2a76d610500345e1f469366346.tar.bz2
re PR middle-end/38851 (Compiler warns about uninitialized variable that is an object with a constructor)
2009-01-26 Richard Guenther <rguenther@suse.de> PR middle-end/38851 * Makefile.in (tree-ssa-dse.o): Add langhooks.h. * tree-ssa-dse.c: Include langhooks.h (execute_simple_dse): Remove stores with zero size. * g++.dg/warn/Wuninitialized-1.C: New testcase. From-SVN: r143672
Diffstat (limited to 'gcc/tree-ssa-dse.c')
-rw-r--r--gcc/tree-ssa-dse.c32
1 files changed, 24 insertions, 8 deletions
diff --git a/gcc/tree-ssa-dse.c b/gcc/tree-ssa-dse.c
index b4be514..8a72495 100644
--- a/gcc/tree-ssa-dse.c
+++ b/gcc/tree-ssa-dse.c
@@ -34,6 +34,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-dump.h"
#include "domwalk.h"
#include "flags.h"
+#include "langhooks.h"
/* This file implements dead store elimination.
@@ -660,20 +661,35 @@ execute_simple_dse (void)
tree op;
bool removed = false;
ssa_op_iter iter;
+ tree size;
- if (gimple_stored_syms (stmt)
- && !bitmap_empty_p (gimple_stored_syms (stmt))
- && (is_gimple_assign (stmt)
- || (is_gimple_call (stmt)
- && gimple_call_lhs (stmt)))
- && !bitmap_intersect_p (gimple_stored_syms (stmt), variables_loaded))
+ if (is_gimple_assign (stmt)
+ && AGGREGATE_TYPE_P (TREE_TYPE (gimple_assign_lhs (stmt)))
+ && (size = lang_hooks.expr_size (gimple_assign_lhs (stmt)))
+ && integer_zerop (size))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, " Deleted zero-sized store '");
+ print_gimple_stmt (dump_file, stmt, 0, dump_flags);
+ fprintf (dump_file, "'\n");
+ }
+ removed = true;
+ gsi_remove (&gsi, true);
+ todo |= TODO_cleanup_cfg;
+ }
+ else if (gimple_stored_syms (stmt)
+ && !bitmap_empty_p (gimple_stored_syms (stmt))
+ && (is_gimple_assign (stmt)
+ || (is_gimple_call (stmt)
+ && gimple_call_lhs (stmt)))
+ && !bitmap_intersect_p (gimple_stored_syms (stmt),
+ variables_loaded))
{
unsigned int i;
bitmap_iterator bi;
bool dead = true;
-
-
/* See if STMT only stores to write-only variables and
verify that there are no volatile operands. tree-ssa-operands
sets has_volatile_ops flag for all statements involving