Skip to content

cmd/compile: function-to-interface conversion leads to miscompilation and segfault #48645

@ghost

Description

What version of Go are you using (go version)?

$ go version
go version devel go1.18-6e5dd0b59b Mon Sep 27 11:52:07 2021 +0000 windows/amd64

Does this issue reproduce with the latest release?

No

What operating system and processor architecture are you using (go env)?

  • windows/amd64
  • linux/amd64 (godbolt)

What did you do?

https://play.golang.org/p/JxrNfegu__C

https://go.godbolt.org/z/1E6Kx3aoT

What did you expect to see?

Successful compilation.

What did you see instead?

Stack trace (with -l flag)
unexpected fault address 0x4666f0
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x2 addr=0x4666f0 pc=0x4666f0]

goroutine 1 [running]:
runtime.throw({0x461472, 0x7fe1f2155108})
	/opt/compiler-explorer/go-tip/src/runtime/panic.go:965 +0x71 fp=0xc00002c680 sp=0xc00002c650 pc=0x42b3f1
runtime.sigpanic()
	/opt/compiler-explorer/go-tip/src/runtime/signal_unix.go:743 +0x305 fp=0xc00002c6d0 sp=0xc00002c680 pc=0x43eb65
main.Stream[.shape.int_0].Iterate(0x4544c5, {{0x45bb00, 0xc00005a000}}, 0x0)
	/app/example.go:22 +0x31 fp=0xc00002c6f0 sp=0xc00002c6d0 pc=0x454411
main.Reduce[.shape.int_0,.shape.[]int_1](0x476d40, {{0x45bb00, 0xc00005a000}}, {0x0, 0x0, 0x0}, 0x4665b8)
	/app/example.go:52 +0xfe fp=0xc00002c738 sp=0xc00002c6f0 pc=0x45469e
main.main()
	/app/example.go:65 +0x4b fp=0xc00002c780 sp=0xc00002c738 pc=0x4541eb
runtime.main()
	/opt/compiler-explorer/go-tip/src/runtime/proc.go:255 +0x227 fp=0xc00002c7e0 sp=0xc00002c780 pc=0x42dbe7
runtime.goexit()
	/opt/compiler-explorer/go-tip/src/runtime/asm_amd64.s:1446 +0x1 fp=0xc00002c7e8 sp=0xc00002c7e0 pc=0x451281

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions