gnolang / gno

Gno: An interpreted, stack-based Go virtual machine to build succinct and composable apps + Gno.land: a blockchain for timeless code and fair open-source
https://gno.land/
Other
842 stars 343 forks source link

[bug/gnovm] arrays returned by functions should not be addressable #2299

Open deelawn opened 3 weeks ago

deelawn commented 3 weeks ago

This bug highlights a difference between gno and go. Here is an example

package main

import "crypto/sha256"

func main() {
    println(sha256.Sum256([]byte("x"))[:])
}

This will execute fine as gno code, but running it as go code yields invalid operation: sha256.Sum256([]byte("x")) (value of type [32]byte) (slice of unaddressable value)

https://goplay.tools/snippet/MxwoBhtYZzz