diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-08-20 21:17:57 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-08-20 21:17:57 -0400 |
| commit | 81c441f8855d4c58f0b2ff86d3d007cf0bf395d3 (patch) | |
| tree | 13e7ad4dc3bed5bed86c570b59393aec1094252f /src/analyze.cpp | |
| parent | 3b5a8858c29582daf37856534abe150b568a7bb7 (diff) | |
| download | zig-81c441f8855d4c58f0b2ff86d3d007cf0bf395d3.tar.gz zig-81c441f8855d4c58f0b2ff86d3d007cf0bf395d3.zip | |
remove incorrect assert regarding 128-bit integers
LLVM incorrectly reports 8 as the alignment of i128 on x86_64 but it
correctly reports 16 as the alignment of i128 on aarch64.
closes #3101
Diffstat (limited to 'src/analyze.cpp')
| -rw-r--r-- | src/analyze.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/analyze.cpp b/src/analyze.cpp index ab994d07e8..a06bba3f2a 100644 --- a/src/analyze.cpp +++ b/src/analyze.cpp @@ -6051,12 +6051,12 @@ ZigType *make_int_type(CodeGen *g, bool is_signed, uint32_t size_in_bits) { entry->abi_size = LLVMABISizeOfType(g->target_data_ref, entry->llvm_type); entry->abi_align = LLVMABIAlignmentOfType(g->target_data_ref, entry->llvm_type); - if (size_in_bits >= 128) { + if (size_in_bits >= 128 && entry->abi_align < 16) { // Override the incorrect alignment reported by LLVM. Clang does this as well. // On x86_64 there are some instructions like CMPXCHG16B which require this. // On all targets, integers 128 bits and above have ABI alignment of 16. + // However for some targets, LLVM incorrectly reports this as 8. // See: https://github.com/ziglang/zig/issues/2987 - assert(entry->abi_align == 8); // if this trips we can remove the workaround entry->abi_align = 16; } } |
