re PR tree-optimization/27090 (FRE does not look past previous type casts)
authorRichard Guenther <rguenther@suse.de>
Mon, 19 Jun 2006 20:10:02 +0000 (20:10 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 19 Jun 2006 20:10:02 +0000 (20:10 +0000)
2006-06-19  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/27090
* g++.dg/tree-ssa/pr27090.C: New testcase.

From-SVN: r114786

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tree-ssa/pr27090.C [new file with mode: 0644]

index 888e45a..8fda51d 100644 (file)
@@ -1,3 +1,8 @@
+2006-06-19  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/27090
+       * g++.dg/tree-ssa/pr27090.C: New testcase.
+
 2006-06-19  Roger Sayle  <roger@eyesopen.com>
 
        PR target/27861
diff --git a/gcc/testsuite/g++.dg/tree-ssa/pr27090.C b/gcc/testsuite/g++.dg/tree-ssa/pr27090.C
new file mode 100644 (file)
index 0000000..a56357a
--- /dev/null
@@ -0,0 +1,21 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-tree-optimized" } */
+
+template <class T>
+struct Bar
+{
+        int get() { return static_cast<T*>(this)->get2(); }
+};
+struct Foo : public Bar<Foo>
+{
+        int get2() { return x; }
+        int x;
+};
+
+int foo(Foo& f)
+{
+        return f.get();
+}
+
+/* { dg-final { scan-tree-dump "return f->x;" "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */