lean4-htt/tests/lean/externBoxing.lean.expected.out
Sebastian Ullrich 17e8765bdc
fix: miscompilation resulting in minor memory leak on extern projections with unboxed arguments (#11383)
This PR fixes the compilation of structure projections with unboxed
arguments marked `extern`, adding missing `dec` instructions. It led to
leaking single allocations when such functions were used as closures or
in the interpreter.

This is the minimal working fix; `extern` should not replicate parts of
the compilation pipeline, which will be possible via #10291.
2025-11-26 19:27:43 +00:00

8 lines
353 B
Text

[Compiler.IR] [result]
extern _private.lean.externBoxing.0.Foo.bar (x_0 : obj) (x_1 : u64) : u64
def _private.lean.externBoxing.0.Foo.bar._boxed (x_1 : obj) (x_2 : tobj) : tobj :=
let x_3 : u64 := unbox x_2;
dec x_2;
let x_4 : u64 := _private.lean.externBoxing.0.Foo.bar x_1 x_3;
let x_5 : tobj := box x_4;
ret x_5