Incorrect alignment on typedef and local variable debug info.

This commit is contained in:
Christoffer Lerno
2026-01-07 00:16:49 +01:00
parent 9ad98beda7
commit 336ddb67c8
3 changed files with 4 additions and 3 deletions

View File

@@ -51,6 +51,7 @@
- Designated initialization with ranges would not error on overflow by 1. - Designated initialization with ranges would not error on overflow by 1.
- `io::read_fully` now handles unbounded streams properly. - `io::read_fully` now handles unbounded streams properly.
- Crash when doing a type property lookup for const inline enums in some cases #2717. - 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 ### Stdlib changes
- Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads. - Add `ThreadPool` join function to wait for all threads to finish in the pool without destroying the threads.

View File

@@ -605,7 +605,7 @@ void llvm_emit_global_variable_init(GenContext *c, Decl *decl)
decl_is_local(decl), decl_is_local(decl),
LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0), LLVMDIBuilderCreateExpression(c->debug.builder, NULL, 0),
NULL, NULL,
decl->alignment); decl->alignment * 8);
LLVMGlobalSetMetadata(llvm_get_ref(c, decl), 0, decl->var.backend_debug_ref); LLVMGlobalSetMetadata(llvm_get_ref(c, decl), 0, decl->var.backend_debug_ref);
} }

View File

@@ -165,7 +165,7 @@ void llvm_emit_debug_local_var(GenContext *c, Decl *decl)
llvm_get_debug_type(c, decl->type), llvm_get_debug_type(c, decl->type),
compiler.build.optlevel != OPTIMIZATION_NONE, compiler.build.optlevel != OPTIMIZATION_NONE,
LLVMDIFlagZero, LLVMDIFlagZero,
decl->alignment); decl->alignment * 8);
decl->var.backend_debug_ref = var; decl->var.backend_debug_ref = var;
ASSERT(!decl->is_value); 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), llvm_get_debug_type(c, original_type),
decl->name, strlen(decl->name), decl->name, strlen(decl->name),
c->debug.file.debug_file, row ? row : 1, 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) if (type->backend_debug_type)
{ {
LLVMMetadataReplaceAllUsesWith(type->backend_debug_type, real); LLVMMetadataReplaceAllUsesWith(type->backend_debug_type, real);