summaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-05 19:37:48 +0000
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>2008-07-05 19:37:48 +0000
commit0bafabac24ea54968b3c6d670f51391232d1d1d3 (patch)
treed2ce9d323f7a8369837c81bd35b927468c1790a0 /gcc/testsuite
parentec2e6a4ef271c923a7f6550ab1bbfa40181352c2 (diff)
downloadgcc-0bafabac24ea54968b3c6d670f51391232d1d1d3.tar.gz
2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
* g++.dg/tree-ssa/ptrmemfield.C: New testcase. 2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com> * fold-const.c (fold_convert_const): Treat OFFSET_TYPE the same as integral and pointer types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@137510 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C27
2 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2cf3a6282d3..7eb21a42d71 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2008-07-05 Andrew Pinski <andrew_pinski@playstation.sony.com>
+
+ * g++.dg/tree-ssa/ptrmemfield.C: New testcase.
+
2008-07-05 Joseph Myers <joseph@codesourcery.com>
* lib/gcc-dg.exp (remove-build-file): Remove files on remote host
diff --git a/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C b/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C
new file mode 100644
index 00000000000..38189eb43af
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tree-ssa/ptrmemfield.C
@@ -0,0 +1,27 @@
+/* { dg-do compile } */
+// { dg-options "-O2 -fdump-tree-final_cleanup" }
+
+
+struct f
+{
+ char m;
+ char m1;
+};
+
+static inline char f:: *g(int a)
+{
+ return a?0:&f::m;
+}
+
+int h(void)
+{
+ char f:: *a = g(0);
+ return a == 0;
+}
+
+/* We should have no cast to offset_type. */
+/* { dg-final { scan-tree-dump-times "offset_type" 0 "final_cleanup"} } */
+// And we should optimized this code to just return 0
+/* { dg-final { scan-tree-dump-times "return 0" 1 "final_cleanup"} } */
+/* { dg-final { cleanup-tree-dump "final_cleanup" } } */
+