diff --git a/releasenotes.md b/releasenotes.md index 93b322aff..ab457c85a 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -51,6 +51,7 @@ - Designated initialization with ranges would not error on overflow by 1. - `io::read_fully` now handles unbounded streams properly. - Crash when doing a type property lookup for const inline enums in some cases #2717. +- Incorrect alignment on typedef and local variable debug info. ### Stdlib changes - Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads. diff --git a/src/compiler/llvm_codegen.c b/src/compiler/llvm_codegen.c index e93b8a292..6c379c4f9 100644 --- a/src/compiler/llvm_codegen.c +++ b/src/compiler/llvm_codegen.c @@ -605,7 +605,7 @@ void llvm_emit_global_variable_init(GenContext *c, Decl *decl) decl_is_local(decl), LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), NULL, - decl->alignment); + decl->alignment * 8); LLVMGlobalSetMetadata(llvm_get_ref(c, decl), 0, decl->var.backend_debug_ref); } diff --git a/src/compiler/llvm_codegen_debug_info.c b/src/compiler/llvm_codegen_debug_info.c index 7e035b250..2d3c6d93c 100644 --- a/src/compiler/llvm_codegen_debug_info.c +++ b/src/compiler/llvm_codegen_debug_info.c @@ -165,7 +165,7 @@ void llvm_emit_debug_local_var(GenContext *c, Decl *decl) llvm_get_debug_type(c, decl->type), compiler.build.optlevel != OPTIMIZATION_NONE, LLVMDIFlagZero, - decl->alignment); + decl->alignment * 8); decl->var.backend_debug_ref = var; ASSERT(!decl->is_value); @@ -548,7 +548,7 @@ static LLVMMetadataRef llvm_debug_typedef_type(GenContext *c, Type *type) llvm_get_debug_type(c, original_type), decl->name, strlen(decl->name), c->debug.file.debug_file, row ? row : 1, - c->debug.file.debug_file, type_abi_alignment(type)); + c->debug.file.debug_file, type_abi_alignment(type) * 8); if (type->backend_debug_type) { LLVMMetadataReplaceAllUsesWith(type->backend_debug_type, real);