diff options
author | John Hodge <tpg@ucc.asn.au> | 2018-08-20 22:37:47 +0800 |
---|---|---|
committer | John Hodge <tpg@ucc.asn.au> | 2018-08-20 22:37:47 +0800 |
commit | 74c2ec9d3c7eb09540a2a5de3127390fa8252179 (patch) | |
tree | 61a9e8f0b21ed087dd385969b0a896fddbc9b326 /src/trans/target.cpp | |
parent | 346da1865a49d7fd354e7aa4e8b5712a2df35a22 (diff) | |
download | mrust-74c2ec9d3c7eb09540a2a5de3127390fa8252179.tar.gz |
Trans - Fix size/alignment mismatches on x86
Diffstat (limited to 'src/trans/target.cpp')
-rw-r--r-- | src/trans/target.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/trans/target.cpp b/src/trans/target.cpp index 004b0bf1..ea850937 100644 --- a/src/trans/target.cpp +++ b/src/trans/target.cpp @@ -685,13 +685,13 @@ bool Target_GetSizeAndAlignOf(const Span& sp, const StaticTraitResolve& resolve, case ::HIR::CoreType::I64: out_size = 8; // TODO: on x86, u64/i64 has an alignment of 4, while x86_64 has 8. What do other platforms have? - out_align = g_target.m_arch.m_pointer_bits == 32 ? 4 : 8; + out_align = g_target.m_arch.m_name == "x86" ? 4 : 8; return true; case ::HIR::CoreType::U128: case ::HIR::CoreType::I128: out_size = 16; // TODO: If i128 is emulated, this can be 8 (as it is on x86, where it's actually 4 due to the above comment) - out_align = g_target.m_arch.m_pointer_bits == 32 ? 4 : 16; + out_align = g_target.m_arch.m_name == "x86" ? 4 : 16; return true; case ::HIR::CoreType::Usize: case ::HIR::CoreType::Isize: @@ -704,7 +704,7 @@ bool Target_GetSizeAndAlignOf(const Span& sp, const StaticTraitResolve& resolve, return true; case ::HIR::CoreType::F64: out_size = 8; - out_align = 8; + out_align = g_target.m_arch.m_name == "x86" ? 4 : 8; return true; case ::HIR::CoreType::Str: DEBUG("sizeof on a `str` - unsized"); |