aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2007-04-26 15:50:32 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2007-04-26 15:50:32 +0000
commit794ed8a5108dd8b1f9d5dc1550432522956c0d3a (patch)
tree02a69f940a1cac49abc415604b1d3dfc6cbb1a84 /gcc
parent5c7ec4f0d5730d28451003ab8304b388f42f2a85 (diff)
downloadgcc-794ed8a5108dd8b1f9d5dc1550432522956c0d3a.zip
gcc-794ed8a5108dd8b1f9d5dc1550432522956c0d3a.tar.gz
gcc-794ed8a5108dd8b1f9d5dc1550432522956c0d3a.tar.bz2
re PR tree-optimization/30567 (-O3 optimizer bug)
2007-04-26 Richard Guenther <rguenther@suse.de> Daniel Berlin <dberlin@dberlin.org> PR tree-optimization/30567 * g++.dg/other/pr30567.C: New testcase. Co-Authored-By: Daniel Berlin <dberlin@dberlin.org> From-SVN: r124191
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/g++.dg/other/pr30567.C33
2 files changed, 39 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index b2db604..bcdbbdd 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 0000000..626d27b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/pr30567.C
@@ -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; }
+