diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-11-26 21:04:12 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-11-26 21:04:12 -0500 |
| commit | a21f9ddfd05c643049c22bb52ab3a60f41933492 (patch) | |
| tree | 8a4e3967f9d8b7863c238a357eb47e978d3a8c41 /src/compile/pointers.c | |
| parent | 14c8cf34dd75fcf49cc56025efa93dd32e1958fd (diff) | |
Bugfix for accidental violation of immutable value guarantees due to
inner field members
Diffstat (limited to 'src/compile/pointers.c')
| -rw-r--r-- | src/compile/pointers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compile/pointers.c b/src/compile/pointers.c index 11348330..98274cc8 100644 --- a/src/compile/pointers.c +++ b/src/compile/pointers.c @@ -55,13 +55,13 @@ Text_t compile_typed_allocation(env_t *env, ast_t *ast, type_t *pointer_type) { type_t *pointed = Match(pointer_type, PointerType)->pointed; switch (ast->tag) { case HeapAllocate: { - return Texts("heap(", compile_to_type(env, Match(ast, HeapAllocate)->value, pointed), ")"); + return Texts("heap(", compile_maybe_incref(env, Match(ast, HeapAllocate)->value, pointed), ")"); } case StackReference: { ast_t *subject = Match(ast, StackReference)->value; if (can_be_mutated(env, subject) && type_eq(pointed, get_type(env, subject))) return Texts("(&", compile_lvalue(env, subject), ")"); - else return Texts("stack(", compile_to_type(env, subject, pointed), ")"); + else return Texts("stack(", compile_maybe_incref(env, subject, pointed), ")"); } default: code_err(ast, "Not an allocation!"); } |
