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')
-rwxr-xr-xgcc/testsuite/g++.old-deja/g++.other/loop1.C30
1 files changed, 30 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 100755
index 0000000..3380dd4
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/loop1.C
@@ -0,0 +1,30 @@
+// Test for bad loop optimization of goto fixups.
+// Special g++ Options: -O2
+
+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);
+}