aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWilliam Sengir <william@sengir.com>2022-03-20 00:00:13 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-21 16:54:19 -0700
commit4e357151a54c9a2f373cef59e2718a61cfbe3658 (patch)
tree9416550e7b7f086bab7648063814dc91e6bacbed /src
parent961248cde32e0d572225c6c1d367b960540ae220 (diff)
downloadzig-4e357151a54c9a2f373cef59e2718a61cfbe3658.tar.gz
zig-4e357151a54c9a2f373cef59e2718a61cfbe3658.zip
stage2: align store for vector-to-array bitcast in LLVM backend
This was causing a very rare segfault when LLVM would emit `vmovdqa` using an unaligned memory operand on the stack.
Diffstat (limited to 'src')
-rw-r--r--src/codegen/llvm.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig
index 13f4f7d01b..107b059765 100644
--- a/src/codegen/llvm.zig
+++ b/src/codegen/llvm.zig
@@ -5563,7 +5563,8 @@ pub const FuncGen = struct {
if (bitcast_ok) {
const llvm_vector_ty = try self.dg.llvmType(operand_ty);
const casted_ptr = self.builder.buildBitCast(array_ptr, llvm_vector_ty.pointerType(0), "");
- _ = self.builder.buildStore(operand, casted_ptr);
+ const llvm_store = self.builder.buildStore(operand, casted_ptr);
+ llvm_store.setAlignment(inst_ty.abiAlignment(target));
} else {
// If the ABI size of the element type is not evenly divisible by size in bits;
// a simple bitcast will not work, and we fall back to extractelement.