summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.old-deja/g++.other/loop1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.old-deja/g++.other/loop1.C')
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/loop1.C31
1 files changed, 31 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.old-deja/g++.other/loop1.C b/gcc/testsuite/g++.old-deja/g++.other/loop1.C
new file mode 100644
index 000000000..168734c54
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/loop1.C
@@ -0,0 +1,31 @@
+// { dg-do run }
+// { dg-options "-O2" }
+// Test for bad loop optimization of goto fixups.
+
+typedef bool (*ftype) ();
+
+int c, d;
+struct A {
+ A() { ++c; }
+ A(const A&) { ++c; }
+ ~A() { ++d; }
+};
+
+void f (ftype func)
+{
+ A a;
+ do {
+ if ((*func)()) return;
+ } while (true);
+}
+
+bool test ()
+{
+ return true;
+}
+
+main ()
+{
+ f (test);
+ return (c != d);
+}