Skip to content
This repository was archived by the owner on Dec 14, 2023. It is now read-only.

Commit 12f466a

Browse files
committed
Convert operand to element type in channel send
Fixes #91
1 parent a91a84c commit 12f466a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

channels.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ func (v *LLVMValue) chanClose() {
2929
}
3030

3131
func (v *LLVMValue) chanSend(value Value) {
32+
elttyp := v.typ.Underlying().(*types.Chan).Elem()
33+
value = value.Convert(elttyp)
3234
var ptr llvm.Value
3335
if value, ok := value.(*LLVMValue); ok && value.pointer != nil {
3436
ptr = value.pointer.LLVMValue()
3537
}
36-
elttyp := v.typ.Underlying().(*types.Chan).Elem()
3738
c := v.compiler
3839
if ptr.IsNil() {
3940
ptr = c.builder.CreateAlloca(c.types.ToLLVM(elttyp), "")
40-
value := value.Convert(elttyp).LLVMValue()
41-
c.builder.CreateStore(value, ptr)
41+
c.builder.CreateStore(value.LLVMValue(), ptr)
4242
}
4343
uintptr_ := c.builder.CreatePtrToInt(ptr, c.target.IntPtrType(), "")
4444
nb := boolLLVMValue(false)

0 commit comments

Comments
 (0)