Skip to content

Commit

Permalink
Fix mem op= mem bug in trans.ml (via not terribly good fix). Closes r…
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon committed Jul 22, 2010
1 parent 2c24f70 commit c96634a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ TEST_XFAILS_LLVM := $(addprefix test/run-pass/, \
generic-tag.rs \
import.rs \
inner-module.rs \
iter-range.rs \
large-records.rs \
lazy-and-or.rs \
lazy-init.rs \
Expand Down
9 changes: 8 additions & 1 deletion src/boot/me/trans.ml
Original file line number Diff line number Diff line change
Expand Up @@ -4343,8 +4343,15 @@ let trans_visitor
trans_vec_append dst_cell dst_ty src_oper (atom_type cx a_src)
| _ ->
let (dst_cell, _) = deref_ty DEREF_none false dst_cell dst_ty in
let bits = Il.operand_bits word_bits src_oper in
(*
* FIXME: X86-ism going via a vreg; mem op= mem doesn't work and
* IL lacks sufficient brains to cope just now.
*)
let src = Il.Reg (Il.next_vreg (emitter()), Il.ValTy bits) in
let op = trans_binop binop in
emit (Il.binary op dst_cell (Il.Cell dst_cell) src_oper);
mov src src_oper;
emit (Il.binary op dst_cell (Il.Cell dst_cell) (Il.Cell src));


and trans_call id dst flv args =
Expand Down
18 changes: 18 additions & 0 deletions src/test/run-pass/iter-range.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
iter range(int a, int b) -> int {
check (a < b);

let int i = a;
while (i < b) {
put i;
i += 1;
}
}

fn main() {
let int sum = 0;
for each (int x in range(0, 100)) {
sum += x;
}

log sum;
}

0 comments on commit c96634a

Please sign in to comment.