Skip to content

Commit c067d50

Browse files
committed
---
yaml --- r: 2835 b: refs/heads/master c: 9a24e4f h: refs/heads/master i: 2833: 8e2af5a 2831: 547f67a v: v3
1 parent 09048a7 commit c067d50

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: dc9d5e168977b9f3e2595b2c33aaf4c90f09ae81
2+
refs/heads/master: 9a24e4f78045bc32a9eec7c7486a9e0dc7b2b78f

trunk/src/comp/middle/tstate/states.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
215215
auto changed = false;
216216
auto num_local_vars = num_locals(fcx.enclosing);
217217

218-
/*
218+
/*
219219
log_err("states:");
220220
log_expr_err(*e);
221-
log_err(middle::ty::expr_ann(e).id);
221+
aux::log_bitv_err(fcx, expr_poststate(fcx.ccx, e));
222222
*/
223223

224224
/* FIXME could get rid of some of the copy/paste */
@@ -236,10 +236,12 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
236236
/* rands go left-to-right */
237237
changed = find_pre_post_state_exprs(fcx,
238238
expr_poststate(fcx.ccx, operator), a, operands) || changed;
239-
/* if this is a failing call, it sets the return value */
239+
/* if this is a failing call, it sets everything as initialized */
240240
alt (controlflow_expr(fcx.ccx, operator)) {
241241
case (noreturn) {
242-
changed = gen_poststate(fcx, a, fcx.id) || changed;
242+
changed = set_poststate_ann(fcx.ccx, a,
243+
false_postcond(num_local_vars))
244+
|| changed;
243245
}
244246
case (_) { }
245247
}
@@ -525,16 +527,17 @@ fn find_pre_post_state_expr(&fn_ctxt fcx, &prestate pres, @expr e) -> bool {
525527
for (arm an_alt in alts) {
526528
changed = find_pre_post_state_block(fcx, e_post,
527529
an_alt.block) || changed;
528-
changed = intersect(a_post,
529-
block_poststate(fcx.ccx,
530-
an_alt.block)) || changed;
530+
intersect(a_post, block_poststate(fcx.ccx, an_alt.block));
531+
// We deliberately do *not* update changed here, because we'd
532+
// go into an infinite loop that way, and the change gets made
533+
// after the if expression.
531534
}
532535
}
533536
else {
534537
// No alts; poststate is the poststate of the test
535538
a_post = e_post;
536539
}
537-
changed = extend_poststate_ann(fcx.ccx, a, a_post);
540+
changed = extend_poststate_ann(fcx.ccx, a, a_post) || changed;
538541
ret changed;
539542
}
540543
case (expr_field(?e, _, ?a)) {

0 commit comments

Comments
 (0)