aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-01-27 10:42:59 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-01-27 10:42:59 +0000
commitb5c3dfbbfb5bd2c75b333b5ef99a06e57d790096 (patch)
tree35e4880bf75f0d631d220529700fa59d67fd7ad5
parent576de5cb6e4c42c549138a661792e1f7efc81724 (diff)
downloadgcc-b5c3dfbbfb5bd2c75b333b5ef99a06e57d790096.zip
gcc-b5c3dfbbfb5bd2c75b333b5ef99a06e57d790096.tar.gz
gcc-b5c3dfbbfb5bd2c75b333b5ef99a06e57d790096.tar.bz2
re PR middle-end/38503 (warnings from -isystem headers strikes back.)
2009-01-27 Richard Guenther <rguenther@suse.de> PR tree-optimization/38503 * cfgexpand.c (expand_gimple_basic_block): Ignore GIMPLE_CHANGE_DYNAMIC_TYPE during expansion. * tree-ssa-structalias.c (set_uids_in_ptset): Do not prune variables that cannot have TBAA applied. (compute_points_to_sets): Do not remove GIMPLE_CHANGE_DYNAMIC_TYPE statements. * g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase. From-SVN: r143700
-rw-r--r--gcc/ChangeLog10
-rw-r--r--gcc/cfgexpand.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C29
-rw-r--r--gcc/tree-ssa-structalias.c18
5 files changed, 49 insertions, 15 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d2c1f4b..39f89ec 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2009-01-27 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/38503
+ * cfgexpand.c (expand_gimple_basic_block): Ignore
+ GIMPLE_CHANGE_DYNAMIC_TYPE during expansion.
+ * tree-ssa-structalias.c (set_uids_in_ptset): Do not prune
+ variables that cannot have TBAA applied.
+ (compute_points_to_sets): Do not remove GIMPLE_CHANGE_DYNAMIC_TYPE
+ statements.
+
2009-01-27 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/38969
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 6d7fe77..a9a52c4 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1970,7 +1970,7 @@ expand_gimple_basic_block (basic_block bb)
return new_bb;
}
}
- else
+ else if (gimple_code (stmt) != GIMPLE_CHANGE_DYNAMIC_TYPE)
{
tree stmt_tree = gimple_to_tree (stmt);
last = get_last_insn ();
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 9b9f8ed..1ebe503 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2009-01-27 Richard Guenther <rguenther@suse.de>
+
+ PR tree-optimization/38503
+ * g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C: New testcase.
+
2009-01-27 Uros Bizjak <ubizjak@gmail.com>
PR middle-end/38969
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C
new file mode 100644
index 0000000..514957b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-placement-new.C
@@ -0,0 +1,29 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-aliasing" } */
+
+inline void *operator new (__SIZE_TYPE__, void *__p) throw() { return __p; }
+
+struct Y {
+ Y() {}
+ int i;
+};
+
+struct X {
+ X() {}
+ void construct(const Y& y)
+ {
+ new (&m_data[0]) Y(y);
+ }
+ bool initialized;
+ char m_data[sizeof (Y)];
+};
+
+void bar(const X&);
+void foo(Y& y)
+{
+ X x;
+ x.construct(y);
+ x.initialized = true;
+ bar(x);
+}
+
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 8b49556b..cae478a 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -4703,7 +4703,8 @@ set_uids_in_ptset (tree ptr, bitmap into, bitmap from, bool is_derefed,
type-based pruning disabled. */
if (vi->is_artificial_var
|| !is_derefed
- || no_tbaa_pruning)
+ || no_tbaa_pruning
+ || vi->no_tbaa_pruning)
bitmap_set_bit (into, DECL_UID (vi->decl));
else
{
@@ -5496,19 +5497,8 @@ compute_points_to_sets (void)
find_func_aliases (phi);
}
- for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); )
- {
- gimple stmt = gsi_stmt (gsi);
-
- find_func_aliases (stmt);
-
- /* The information in GIMPLE_CHANGE_DYNAMIC_TYPE statements
- has now been captured, and we can remove them. */
- if (gimple_code (stmt) == GIMPLE_CHANGE_DYNAMIC_TYPE)
- gsi_remove (&gsi, true);
- else
- gsi_next (&gsi);
- }
+ for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
+ find_func_aliases (gsi_stmt (gsi));
}