Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack overflow when compiling interface containing type T struct { f *T } value #440

Closed
slimsag opened this issue Jul 6, 2019 · 1 comment
Labels
bug Something isn't working duplicate This issue or pull request already exists

Comments

@slimsag
Copy link

slimsag commented Jul 6, 2019

While attempting to get Vecty compiling under TinyGo I ran into a problem which can be reduced to the following:

package main

func main() {
	Use(&T{})
}

type T struct {
	a *T
}

func Use(x interface{}) {}

When compiled under TinyGo 0.6.0, the compiler panics with:

runtime: goroutine stack exceeds 1000000000-byte limit
fatal error: stack overflow

runtime stack:
runtime.throw(0x346b0f9, 0xe)
        /usr/local/go/src/runtime/panic.go:617 +0x72
runtime.newstack()
        /usr/local/go/src/runtime/stack.go:1041 +0x6f0
runtime.morestack()
        /usr/local/go/src/runtime/asm_amd64.s:429 +0x8f

goroutine 1 [running]:
runtime.makeslice(0x33e0ac0, 0xd, 0x40, 0x0)
        /usr/local/go/src/runtime/slice.go:34 +0xf9 fp=0xc024000370 sp=0xc024000368 pc=0x8d9fa9
bytes.(*Buffer).grow(0xc000a099b0, 0xd, 0x0)
        /usr/local/go/src/bytes/buffer.go:131 +0x26b fp=0xc0240003c0 sp=0xc024000370 pc=0x90eaab
bytes.(*Buffer).WriteString(0xc000a099b0, 0x7fffef997f29, 0xd, 0x0, 0x0, 0x8)
        /usr/local/go/src/bytes/buffer.go:187 +0xe7 fp=0xc0240003f0 sp=0xc0240003c0 pc=0x90edd7
go/types.writePackage(0xc000a099b0, 0xc00029a910, 0x0)
        /usr/local/go/src/go/types/object.go:443 +0x64 fp=0xc024000430 sp=0xc0240003f0 pc=0xa33524
go/types.writeType(0xc000a099b0, 0x34e6540, 0xc0002a17d0, 0x0, 0xc0240005a8, 0x1, 0x8)
        /usr/local/go/src/go/types/typestring.go:233 +0xbda fp=0xc024000568 sp=0xc024000430 pc=0xa47cda
go/types.WriteType(...)
        /usr/local/go/src/go/types/typestring.go:75
go/types.TypeString(0x34e6540, 0xc0002a17d0, 0x0, 0x0, 0xc0000fe000)
        /usr/local/go/src/go/types/typestring.go:67 +0xb1 fp=0xc024000638 sp=0xc024000568 pc=0xa47061
go/types.(*Named).String(...)
        /usr/local/go/src/go/types/type.go:490
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6540, 0xc0002a17d0, 0xc000a09980, 0x30)
        /home/circleci/project/compiler/interface.go:63 +0x1010 fp=0xc0240007e8 sp=0xc024000638 pc=0xb9d0a0
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6580, 0xc00029c9a0, 0x1, 0xc000a03080)
        /home/circleci/project/compiler/interface.go:125 +0xe54 fp=0xc024000998 sp=0xc0240007e8 pc=0xb9cee4
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6540, 0xc0002a17d0, 0xc000a09950, 0x30)
        /home/circleci/project/compiler/interface.go:145 +0x54a fp=0xc024000b48 sp=0xc024000998 pc=0xb9c5da
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6580, 0xc00029c9a0, 0x1, 0xc000a03070)
        /home/circleci/project/compiler/interface.go:125 +0xe54 fp=0xc024000cf8 sp=0xc024000b48 pc=0xb9cee4
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6540, 0xc0002a17d0, 0xc000a09920, 0x30)
        /home/circleci/project/compiler/interface.go:145 +0x54a fp=0xc024000ea8 sp=0xc024000cf8 pc=0xb9c5da
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6580, 0xc00029c9a0, 0x1, 0xc000a03060)
        /home/circleci/project/compiler/interface.go:125 +0xe54 fp=0xc024001058 sp=0xc024000ea8 pc=0xb9cee4
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6540, 0xc0002a17d0, 0xc000a098f0, 0x30)
        /home/circleci/project/compiler/interface.go:145 +0x54a fp=0xc024001208 sp=0xc024001058 pc=0xb9c5da
github.com/tinygo-org/tinygo/compiler.getTypeCodeName(0x34e6580, 0xc00029c9a0, 0x1, 0xc000a03050)
        /home/circleci/project/compiler/interface.go:125 +0xe54 fp=0xc0240013b8 sp=0xc024001208 pc=0xb9cee4
[...]
@deadprogram deadprogram added the bug Something isn't working label Jul 7, 2019
@aykevl aykevl added the duplicate This issue or pull request already exists label Jul 17, 2019
@aykevl
Copy link
Member

aykevl commented Jul 17, 2019

Thank you for the report! However, this bug has already been reported here:
#309

@aykevl aykevl closed this as completed Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants