Open alaviss opened 2 months ago
The problem lies in line 35, with the minimal reproducer being:
type
Proc = proc (x: int): int {.nimcall.}
Obj = object
tup: (lent Proc,)
let
p = proc(x: int): int = x
o = Obj(tup: (p,))
As can be seen in the (shortened) --showir:transf
output:
0 N:LetSection
0 N:IdentDefs
0 N:Sym "o" sk:skLet
1 N:Empty
2 N:ObjConstr
0 N:Sym "Obj" sk:skType
1 N:ExprColonExpr
0 N:Sym "tup" sk:skField
offset: 0
1 N:TupleConstr
0 N:Sym "p" sk:skLet # <- this is the important part
The HiddenAddr
operation for creating a view of p
is missing, meaning that a function pointer is assigned to a location expecting a pointer to a function pointer.
All backends are affected.
Example
Actual Output