[llvm-commits] [test-suite] r114264 - /test-suite/trunk/SingleSource/Regression/C++/fixups.cpp
John McCall
rjmccall at apple.com
Fri Sep 17 20:12:52 PDT 2010
Author: rjmccall
Date: Fri Sep 17 22:12:52 2010
New Revision: 114264
URL: http://llvm.org/viewvc/llvm-project?rev=114264&view=rev
Log:
Regression test for fixups.
Added:
test-suite/trunk/SingleSource/Regression/C++/fixups.cpp
Added: test-suite/trunk/SingleSource/Regression/C++/fixups.cpp
URL: http://llvm.org/viewvc/llvm-project/test-suite/trunk/SingleSource/Regression/C%2B%2B/fixups.cpp?rev=114264&view=auto
==============================================================================
--- test-suite/trunk/SingleSource/Regression/C++/fixups.cpp (added)
+++ test-suite/trunk/SingleSource/Regression/C++/fixups.cpp Fri Sep 17 22:12:52 2010
@@ -0,0 +1,50 @@
+#include "stdlib.h"
+
+// PR8175
+
+int count = 0;
+
+struct L {
+ int n;
+ L(int n) : n(n) { count += n; }
+ ~L() { count -= n; }
+};
+
+void test0(int n) {
+ {
+ L b(n);
+ if (n) goto l;
+ }
+
+ l: if (count) abort();
+}
+
+void test1(int n) {
+ {
+ L a(n);
+ L b(n);
+ if (n) goto l;
+ }
+
+ l: if (count) abort();
+}
+
+void test2(int n) {
+ {
+ L a(n);
+ {
+ L b(n);
+ if (n) goto l1;
+ }
+
+ l1: goto l2;
+ }
+ l2: if (count) abort();
+}
+
+int main(int argc, char *argv[]) {
+ test0(1);
+ test1(1);
+ test2(1);
+ return 0;
+}
More information about the llvm-commits
mailing list