mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-24 15:03:46 +00:00
fix bug in use of alignment in free for tag unions
This commit is contained in:
parent
c618cd5a4b
commit
ec0eddb8b2
2 changed files with 3 additions and 2 deletions
|
@ -267,8 +267,9 @@ pub fn freeDataPtrC(
|
|||
const masked_ptr = ptr & ~tag_mask;
|
||||
|
||||
const isizes: [*]isize = @as([*]isize, @ptrFromInt(masked_ptr));
|
||||
const offset = @max(1, @divFloor(alignment, @sizeOf(usize)));
|
||||
|
||||
return freeRcPtrC(isizes - 1, alignment);
|
||||
return freeRcPtrC(isizes - offset, alignment);
|
||||
}
|
||||
|
||||
pub fn freeRcPtrC(
|
||||
|
|
|
@ -3464,7 +3464,7 @@ pub(crate) fn build_exp_stmt<'a, 'ctx>(
|
|||
Free(symbol) => {
|
||||
// unconditionally deallocate the symbol
|
||||
let (value, layout) = scope.load_symbol_and_layout(symbol);
|
||||
let alignment = layout_interner.alignment_bytes(layout);
|
||||
let alignment = layout_interner.allocation_alignment_bytes(layout);
|
||||
|
||||
debug_assert!(value.is_pointer_value());
|
||||
let value = value.into_pointer_value();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue