From 553f00bdb8ed3bee54e8be8dacc4ab4994455189 Mon Sep 17 00:00:00 2001 From: Ayke van Laethem Date: Mon, 4 Feb 2019 13:13:26 +0100 Subject: [PATCH] interp: fix uintptr type context in interface This bug led to a non-obvious validation error after interp had run. --- interp/frame.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/interp/frame.go b/interp/frame.go index ef0b128e..008d5653 100644 --- a/interp/frame.go +++ b/interp/frame.go @@ -308,7 +308,8 @@ func (fr *frame) evalBasicBlock(bb, incoming llvm.BasicBlock, indent string) (re ret = llvm.ConstInsertValue(ret, retLen, []uint32{2}) // cap fr.locals[inst] = &LocalValue{fr.Eval, ret} case callee.Name() == "runtime.makeInterface": - fr.locals[inst] = &LocalValue{fr.Eval, llvm.ConstPtrToInt(inst.Operand(0), fr.TargetData.IntPtrType())} + uintptrType := callee.Type().Context().IntType(fr.TargetData.PointerSize() * 8) + fr.locals[inst] = &LocalValue{fr.Eval, llvm.ConstPtrToInt(inst.Operand(0), uintptrType)} case strings.HasPrefix(callee.Name(), "runtime.print") || callee.Name() == "runtime._panic": // This are all print instructions, which necessarily have side // effects but no results.