mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-04 19:17:47 +00:00
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.
This commit is contained in:
committed by
Ron Evans
parent
64058c3efb
commit
d8ac7ccaae
+7
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user