aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C38
1 files changed, 38 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C b/gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C
new file mode 100644
index 000000000..b8c3e5bed
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/other/pr49912.C
@@ -0,0 +1,38 @@
+// PR rtl-optimization/49912
+// { dg-do compile }
+// { dg-require-effective-target freorder }
+// { dg-options "-O -freorder-blocks-and-partition" }
+
+int foo (int *);
+
+struct S
+{
+ int *m1 ();
+ S (int);
+ ~S () { foo (m1 ()); }
+};
+
+template <int>
+struct V
+{
+ S *v1;
+ void m2 (const S &);
+ S *base ();
+};
+
+template <int N>
+void V<N>::m2 (const S &x)
+{
+ S a = x;
+ S *l = base ();
+ while (l)
+ *v1 = *--l;
+}
+
+V<0> v;
+
+void
+foo ()
+{
+ v.m2 (0);
+}