valFromData BitCast bugfix

This commit is contained in:
xushiwei
2024-05-24 09:30:16 +08:00
parent 056ad51c24
commit 77eeea95c7
2 changed files with 68 additions and 64 deletions

View File

@@ -196,6 +196,9 @@ func (b Builder) valFromData(typ Type, data llvm.Value) Expr {
return b.buildVal(typ, castInt(b, x, t), lvl)
case abi.BitCast:
x := castUintptr(b, data, prog.Uintptr())
if int(prog.SizeOf(t)) != prog.PointerSize() {
x = castInt(b, x, prog.Int32())
}
return b.buildVal(typ, llvm.CreateBitCast(b.impl, x, t.ll), lvl)
}
panic("todo")