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
901 stars 378 forks source link

Recursive struct induces stack overflow #3205

Open mvertes opened 2 days ago

mvertes commented 2 days ago

The following valid Go code fails in gno:

package main

import "fmt"

type node struct {
    parent *node
    child  []*node
    key    string
}

func main() {
    root := &node{key: "root"}
    root.child = nil
    fmt.Println("root:", root)
}

// Output:
// root: &{<nil> [] root}
MikaelVallenet commented 1 day ago

related: https://github.com/gnolang/gno/issues/2850