Skip to content

Fix truncated drop pattern on 32bit -> 64bit cross compilation #31283

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 2 additions & 18 deletions src/librustc_trans/trans/adt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,28 +229,12 @@ pub const DTOR_NEEDED_HINT: u8 = 0x3d;
pub const DTOR_MOVED_HINT: u8 = 0x2d;

pub const DTOR_NEEDED: u8 = 0xd4;
pub const DTOR_NEEDED_U32: u32 = repeat_u8_as_u32(DTOR_NEEDED);
pub const DTOR_NEEDED_U64: u64 = repeat_u8_as_u64(DTOR_NEEDED);
#[allow(dead_code)]
pub fn dtor_needed_usize(ccx: &CrateContext) -> usize {
match &ccx.tcx().sess.target.target.target_pointer_width[..] {
"32" => DTOR_NEEDED_U32 as usize,
"64" => DTOR_NEEDED_U64 as usize,
tws => panic!("Unsupported target word size for int: {}", tws),
}
}
pub const DTOR_NEEDED_U64: u64 = repeat_u8_as_u64(DTOR_NEEDED);

pub const DTOR_DONE: u8 = 0x1d;
pub const DTOR_DONE_U32: u32 = repeat_u8_as_u32(DTOR_DONE);
pub const DTOR_DONE_U64: u64 = repeat_u8_as_u64(DTOR_DONE);
#[allow(dead_code)]
pub fn dtor_done_usize(ccx: &CrateContext) -> usize {
match &ccx.tcx().sess.target.target.target_pointer_width[..] {
"32" => DTOR_DONE_U32 as usize,
"64" => DTOR_DONE_U64 as usize,
tws => panic!("Unsupported target word size for int: {}", tws),
}
}
pub const DTOR_DONE_U64: u64 = repeat_u8_as_u64(DTOR_DONE);

fn dtor_to_init_u8(dtor: bool) -> u8 {
if dtor { DTOR_NEEDED } else { 0 }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/trans/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ fn make_drop_glue<'blk, 'tcx>(bcx: Block<'blk, 'tcx>, v0: ValueRef, g: DropGlueK
// the special dtor markings.

let inttype = Type::int(bcx.ccx());
let dropped_pattern = C_integral(inttype, adt::dtor_done_usize(bcx.fcx.ccx) as u64, false);
let dropped_pattern = C_integral(inttype, adt::DTOR_DONE_U64, false);

match t.sty {
ty::TyBox(content_ty) => {
Expand Down