about summary refs log tree commit diff
path: root/src/comp/middle
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2011-08-12 16:15:03 -0700
committerTim Chevalier <chevalier@alum.wellesley.edu>2011-08-12 16:26:10 -0700
commitc01e48748504934e27ac89b2ca12d7d626e3be42 (patch)
tree5bc6ba38ad951f1aa306aa0200e45472f39f97b0 /src/comp/middle
parent60e1cead9bab129b1937a11c71ab2ab2fd751792 (diff)
downloadrust-c01e48748504934e27ac89b2ca12d7d626e3be42.tar.gz
rust-c01e48748504934e27ac89b2ca12d7d626e3be42.zip
Un-XFAIL do-while-body-fails
Made it work both with optimization enabled, and with optimization
disabled. Huzzah!
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/trans.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index a0df89444cd..213a0e87045 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3805,7 +3805,14 @@ fn trans_do_while(cx: &@block_ctxt, body: &ast::blk, cond: &@ast::expr) ->
     if is_terminated(body_res.bcx) {
         // This is kind of ridiculous, but no permutations
         // involving body_res or body_cx.val worked.
-        ret trans_block(cx, body, return);
+        let rs = trans_block(cx, body, return);
+        if ! is_terminated (next_cx) {
+            next_cx.build.Unreachable();
+        }
+        if ! is_terminated (body_cx) {
+            body_cx.build.Unreachable();
+        }
+        ret rs;
     }
     let cond_res = trans_expr(body_res.bcx, cond);
     cond_res.bcx.build.CondBr(cond_res.val, body_cx.llbb, next_cx.llbb);