Skip to content

Commit 553f00b

Browse files
aykevldeadprogram
authored andcommitted
interp: fix uintptr type context in interface
This bug led to a non-obvious validation error after interp had run.
1 parent a789108 commit 553f00b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

interp/frame.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,8 @@ func (fr *frame) evalBasicBlock(bb, incoming llvm.BasicBlock, indent string) (re
308308
ret = llvm.ConstInsertValue(ret, retLen, []uint32{2}) // cap
309309
fr.locals[inst] = &LocalValue{fr.Eval, ret}
310310
case callee.Name() == "runtime.makeInterface":
311-
fr.locals[inst] = &LocalValue{fr.Eval, llvm.ConstPtrToInt(inst.Operand(0), fr.TargetData.IntPtrType())}
311+
uintptrType := callee.Type().Context().IntType(fr.TargetData.PointerSize() * 8)
312+
fr.locals[inst] = &LocalValue{fr.Eval, llvm.ConstPtrToInt(inst.Operand(0), uintptrType)}
312313
case strings.HasPrefix(callee.Name(), "runtime.print") || callee.Name() == "runtime._panic":
313314
// This are all print instructions, which necessarily have side
314315
// effects but no results.

0 commit comments

Comments
 (0)