aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-07 18:00:29 -0700
committerPatrick Walton <[email protected]>2011-04-07 18:02:01 -0700
commitf28a9d8f5203fc01c870ec15b44f8156ebc63168 (patch)
tree67b1980c1308322945af7e76cfb2199328f832e8
parentadd FIXME related to the -fno-strict-aliasing workaround (diff)
downloadrust-f28a9d8f5203fc01c870ec15b44f8156ebc63168.tar.xz
rust-f28a9d8f5203fc01c870ec15b44f8156ebc63168.zip
rustc: Pointer cast when crossing a box boundary for statically-sized elements in trans_index()
-rw-r--r--src/comp/middle/trans.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index a8e75176..28b22ea2 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -3892,6 +3892,10 @@ fn trans_index(@block_ctxt cx, &ast.span sp, @ast.expr base,
elt = next_cx.build.GEP(body, vec(C_int(0), scaled_ix));
} else {
elt = next_cx.build.GEP(body, vec(C_int(0), ix_val));
+
+ // We're crossing a box boundary here, so we may need to pointer cast.
+ auto llunitty = type_of(next_cx.fcx.ccx, unit_ty);
+ elt = next_cx.build.PointerCast(elt, T_ptr(llunitty));
}
ret lval_mem(next_cx, elt);