Skip to content

compiler crash on defer inside range-over-func #4441

Open
@ALTree

Description

@ALTree
$ tinygo version
tinygo version 0.33.0 linux/amd64 (using go version go1.23.0 and LLVM version 18.1.2)
package main

func main() {
	for range func(func() bool) {} {
		defer func() {}()
	}
}
$ tinygo build crash.go
panic: *ssa.opaqueType: deferStack

goroutine 10 [running]:
golang.org/x/tools/go/types/typeutil.Hasher.hashFor({0xc000585650?, 0xc000585680?, 0x0?}, {0x6524780?, 0x866af40?})
	/go/pkg/mod/golang.org/x/tools@v0.22.1-0.20240621165957-db513b091504/go/types/typeutil/map.go:375 +0x58c
golang.org/x/tools/go/types/typeutil.Hasher.Hash({0xc000585650?, 0xc000585680?, 0x0?}, {0x6524780, 0x866af40})
	/go/pkg/mod/golang.org/x/tools@v0.22.1-0.20240621165957-db513b091504/go/types/typeutil/map.go:240 +0x75
golang.org/x/tools/go/types/typeutil.Hasher.hashFor({0xc000585650?, 0xc000585680?, 0x0?}, {0x6523da8?, 0x866af30})
	/go/pkg/mod/golang.org/x/tools@v0.22.1-0.20240621165957-db513b091504/go/types/typeutil/map.go:286 +0x165
golang.org/x/tools/go/types/typeutil.Hasher.Hash({0xc000585650?, 0xc000585680?, 0x0?}, {0x6523da8, 0x866af30})

[...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcore

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions