aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-04 12:36:56 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2009-03-04 12:36:56 +0000
commitf13e5f6dd8cd99c43d9adc9608b806b0266ffc0a (patch)
tree92c85ca3e2336e61a8a95e170ee3d512f57cdf2a /gcc
parent40f3f62f96c71964e57319f0f64266f7d577ce97 (diff)
2009-03-04 Richard Guenther <rguenther@suse.de>
PR tree-optimization/39358 * tree-ssa-structalias.c (do_sd_constraint): Fix check for escaped_id and callused_id. (solve_graph): Likewise. * g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C: New testcase. * g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@144602 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C19
-rw-r--r--gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C35
-rw-r--r--gcc/tree-ssa-structalias.c15
5 files changed, 75 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 6eb37db88f2..b75d2ddb3fa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
2009-03-04 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/39358
+ * tree-ssa-structalias.c (do_sd_constraint): Fix check for
+ escaped_id and callused_id.
+ (solve_graph): Likewise.
+
+2009-03-04 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/39339
* tree-sra.c (try_instantiate_multiple_fields): Make it
no longer ICE on the above.
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index fc081f5ecc4..508b7e3d9a2 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,11 @@
2009-03-04 Richard Guenther <rguenther@suse.de>
+ PR tree-optimization/39358
+ * g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C: New testcase.
+ * g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C: Likewise.
+
+2009-03-04 Richard Guenther <rguenther@suse.de>
+
PR tree-optimization/39339
* gcc.c-torture/execute/pr39339.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C
new file mode 100644
index 00000000000..29414e00e36
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-2.C
@@ -0,0 +1,19 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-aliasing" } */
+
+#include<list>
+
+struct A
+{
+ virtual ~A();
+};
+
+A* foo();
+
+void bar(std::list<int> x)
+{
+ std::list<int> y = x;
+ if (*y.rbegin())
+ delete foo();
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C
new file mode 100644
index 00000000000..de6b2c47735
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-escape-3.C
@@ -0,0 +1,35 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -Wstrict-aliasing" } */
+
+struct Node_base {};
+
+struct Node : Node_base
+{
+ int data;
+};
+
+struct List
+{
+ Node_base node, *prev;
+
+ List() : prev(&node) { xyz(); }
+
+ void xyz();
+
+ int back() { return static_cast<Node*>(prev)->data; }
+};
+
+struct A
+{
+ virtual ~A();
+};
+
+A* foo();
+
+void bar()
+{
+ List y;
+ if (y.back())
+ delete foo();
+}
+
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 07fd9ed2a85..732bc6f7938 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -1524,8 +1524,8 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
of a variable can also reach all other fields of the variable
we simply have to expand the solution to contain all sub-fields
if one sub-field is contained. */
- if (c->rhs.var == escaped_id
- || c->rhs.var == callused_id)
+ if (c->rhs.var == find (escaped_id)
+ || c->rhs.var == find (callused_id))
{
bitmap vars = NULL;
/* In a first pass record all variables we need to add all
@@ -1594,9 +1594,10 @@ do_sd_constraint (constraint_graph_t graph, constraint_t c,
/* Merging the solution from ESCAPED needlessly increases
the set. Use ESCAPED as representative instead.
Same for CALLUSED. */
- else if (get_varinfo (t)->id == escaped_id
- || get_varinfo (t)->id == callused_id)
- flag |= bitmap_set_bit (sol, get_varinfo (t)->id);
+ else if (get_varinfo (t)->id == find (escaped_id))
+ flag |= bitmap_set_bit (sol, escaped_id);
+ else if (get_varinfo (t)->id == find (callused_id))
+ flag |= bitmap_set_bit (sol, callused_id);
else if (add_graph_edge (graph, lhs, t))
flag |= bitmap_ior_into (sol, get_varinfo (t)->solution);
}
@@ -2516,8 +2517,8 @@ solve_graph (constraint_graph_t graph)
if (!solution_empty
/* Do not propagate the ESCAPED/CALLUSED solutions. */
- && i != escaped_id
- && i != callused_id)
+ && i != find (escaped_id)
+ && i != find (callused_id))
{
bitmap_iterator bi;