summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CodeGen/dostmt.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/test/CodeGen/dostmt.c b/test/CodeGen/dostmt.c
new file mode 100644
index 0000000000..b721974dc5
--- /dev/null
+++ b/test/CodeGen/dostmt.c
@@ -0,0 +1,62 @@
+// RUN: clang %s -emit-llvm
+
+int bar();
+int foo() {
+ int i;
+ i = 1 + 2;
+ do {
+ i = bar();
+ i = bar();
+ } while(0);
+ return i;
+}
+
+
+int foo1() {
+ int i;
+ i = 1 + 2;
+ do {
+ i = bar();
+ if (i == 42)
+ break;
+ i = bar();
+ } while(1);
+ return i;
+}
+
+
+int foo2() {
+ int i;
+ i = 1 + 2;
+ do {
+ i = bar();
+ if (i == 42)
+ continue;
+ i = bar();
+ } while(1);
+ return i;
+}
+
+
+int foo3() {
+ int i;
+ i = 1 + 2;
+ do {
+ i = bar();
+ if (i == 42)
+ break;
+ } while(0);
+ return i;
+}
+
+
+int foo4() {
+ int i;
+ i = 1 + 2;
+ do {
+ i = bar();
+ if (i == 42)
+ continue;
+ } while(0);
+ return i;
+}