OSDN Git Service

2007-04-26 Richard Guenther <rguenther@suse.de>
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Apr 2007 15:50:32 +0000 (15:50 +0000)
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 26 Apr 2007 15:50:32 +0000 (15:50 +0000)
        Daniel Berlin  <dberlin@dberlin.org>

        PR tree-optimization/30567
        * g++.dg/other/pr30567.C: New testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@124191 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/other/pr30567.C [new file with mode: 0644]

index b2db604..bcdbbdd 100644 (file)
@@ -1,4 +1,10 @@
 2007-04-26  Richard Guenther  <rguenther@suse.de>
+       Daniel Berlin  <dberlin@dberlin.org>
+
+       PR tree-optimization/30567
+       * g++.dg/other/pr30567.C: New testcase.
+
+2007-04-26  Richard Guenther  <rguenther@suse.de>
 
        PR tree-optimization/31703
        * gcc.c-torture/compile/pr31703.c: New testcase.
diff --git a/gcc/testsuite/g++.dg/other/pr30567.C b/gcc/testsuite/g++.dg/other/pr30567.C
new file mode 100644 (file)
index 0000000..626d27b
--- /dev/null
@@ -0,0 +1,33 @@
+/* { dg-do run } */
+/* { dg-options "-O -finline-functions -fstrict-aliasing" } */
+
+template <typename T>
+struct const_ref
+{
+  const T* begin;
+  const_ref(const T* b) : begin(b) {}
+};
+
+template <typename T>
+T sum(const_ref<T> const& a)
+{
+  T result = 0;
+  for(unsigned i=0;i<1;i++) result += a.begin[i];
+  return result;
+}
+
+struct tiny_plain
+{
+  int elems[2];
+  tiny_plain() { elems[0]=1; }
+};
+
+struct vec3 : tiny_plain {};
+
+struct mat3
+{
+  int type() const { return sum(const_ref<int>(vec3().elems)) == 1; }
+};
+
+int main() { return mat3().type() ? 0 : 1; }
+