re PR tree-optimization/63551 (wrong code (segfaults) at -Os on x86_64-linux-gnu)
authorMarek Polacek <polacek@redhat.com>
Thu, 30 Apr 2015 18:01:07 +0000 (18:01 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 30 Apr 2015 18:01:07 +0000 (18:01 +0000)
PR tree-optimization/63551
     * g++.dg/ipa/pr63551.C: New test.

From-SVN: r222650

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

index 00af2c428333767e008dfeb7d8dc9fbe0722f313..aa0123502c798d8b59e0c688b4161bc2807cd232 100644 (file)
@@ -1,3 +1,8 @@
+2015-04-30  Marek Polacek  <polacek@redhat.com>
+
+       PR tree-optimization/63551
+       * g++.dg/ipa/pr63551.C: New test.
+
 2015-04-30  Caroline Tice  <cmtice@google.com>
 
        PR  65929
diff --git a/gcc/testsuite/g++.dg/ipa/pr63551.C b/gcc/testsuite/g++.dg/ipa/pr63551.C
new file mode 100644 (file)
index 0000000..03e0339
--- /dev/null
@@ -0,0 +1,23 @@
+// { dg-options "-O -Wno-psabi" }
+// { dg-do compile }
+
+struct A { int a; };
+template <typename T, typename V> struct B { V operator[] (T); };
+union U { long double ld; void *v; };
+A a;
+
+void
+bar (U &x)
+{
+  if (x.v) *reinterpret_cast <A *>(x.v) = a;
+}
+
+struct C { C (A) { c.ld = 0; bar (c); } U c; };
+struct D { A d, e; void foo () { f[0][d] = e; } B <int, B <A, C> > f; };
+
+void
+baz ()
+{
+  D d;
+  d.foo ();
+}