interp: fix a bug in pointer cast workaround

This was triggered by the following code:

    var smallPrimesProduct = new(big.Int).SetUint64(16294579238595022365)

It is part of the new TinyGo version of the crypto/rand package.
Этот коммит содержится в:
Ayke van Laethem 2021-06-19 20:22:39 +02:00 коммит произвёл Ron Evans
родитель 64058c3efb
коммит d8ac7ccaae

Просмотреть файл

@ -129,7 +129,7 @@ func Run(mod llvm.Module, debug bool) error {
// Update all global variables in the LLVM module.
mem := memoryView{r: r}
for _, obj := range r.objects {
for i, obj := range r.objects {
if obj.llvmGlobal.IsNil() {
continue
}
@ -159,6 +159,12 @@ func Run(mod llvm.Module, debug bool) error {
name := obj.llvmGlobal.Name()
obj.llvmGlobal.EraseFromParentAsGlobal()
newGlobal.SetName(name)
// Update interp-internal references.
delete(r.globals, obj.llvmGlobal)
obj.llvmGlobal = newGlobal
r.globals[newGlobal] = i
r.objects[i] = obj
continue
}
if err != nil {