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

cmd/compile: internal compiler error: weird Sym #50121

Closed
zhuah opened this issue Dec 13, 2021 · 3 comments
Closed

cmd/compile: internal compiler error: weird Sym #50121

zhuah opened this issue Dec 13, 2021 · 3 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@zhuah
Copy link

zhuah commented Dec 13, 2021

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

$ go version
go version devel go1.18-9c6e8f63c0 Sun Dec 12 06:14:07 2021 +0000 darwin/amd64

Does this issue reproduce with the latest release?

No

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

go env Output
$ go env

What did you do?

I'm experiment generics with tip version.

there is a compile error found in my codebase, i have make a minimal test case to reproduce it:
https://go.dev/play/p/zl_QeszZqcq?v=gotip

-- go.mod --
module play
-- p1/p1.go --
package p1

import (
	"constraints"
	"math/rand"
)

type Builder[T constraints.Integer] struct{}

func (r Builder[T]) New() T {
	return T(rand.Int())
}
-- p2/p2.go --
package p2

import (
	"play/p1"
)

var IntBuilder = p1.Builder[int]{}
-- p3/p3.go --
package p3

import (
	"play/p2"
)

func BuildInt() int {
	return p2.IntBuilder.New()
}
-- p4/p4.go --
package p4

import (
	"play/p3"
)

func BuildInt() int {
	return p3.BuildInt()
}
-- main.go --
package main

import (
	"fmt"
	"play/p4"
)

func main() {
	fmt.Println(p4.BuildInt())
}

What did you expect to see?

What did you see instead?

# play/p4
<autogenerated>:1: internal compiler error: weird Sym: p1.Builder[go.shape.int_0].New, p1.Builder[go.shape.int_0].New

goroutine 1 [running]:
runtime/debug.Stack()
	/usr/local/go/src/runtime/debug/stack.go:24 +0x65
cmd/compile/internal/base.FatalfAt({0x3f0378?, 0xc0?}, {0xd23c01, 0x11}, {0xc0004af828, 0x2, 0x2})
	/usr/local/go/src/cmd/compile/internal/base/print.go:227 +0x1ca
cmd/compile/internal/base.Fatalf(...)
	/usr/local/go/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/typecheck.(*iexporter).pushDecl(0xc0003f0370, 0xc00007edd0)
	/usr/local/go/src/cmd/compile/internal/typecheck/iexport.go:461 +0xb7
cmd/compile/internal/typecheck.WriteExports({0xe8b3a0, 0xc000086f60}, 0x1)
	/usr/local/go/src/cmd/compile/internal/typecheck/iexport.go:326 +0x2af
cmd/compile/internal/noder.WriteExports(0xc00008ce30)
	/usr/local/go/src/cmd/compile/internal/noder/export.go:40 +0x7a
cmd/compile/internal/gc.dumpCompilerObj(0xc00008ce30?)
	/usr/local/go/src/cmd/compile/internal/gc/obj.go:107 +0x28
cmd/compile/internal/gc.dumpobj1({0x7ffeda2ecc62, 0x23}, 0x3)
	/usr/local/go/src/cmd/compile/internal/gc/obj.go:63 +0x17b
cmd/compile/internal/gc.dumpobj()
	/usr/local/go/src/cmd/compile/internal/gc/obj.go:44 +0x36
cmd/compile/internal/gc.Main(0xd4a7f0)
	/usr/local/go/src/cmd/compile/internal/gc/main.go:335 +0x11fc
main.main()
	/usr/local/go/src/cmd/compile/main.go:55 +0xdd


Go build failed.
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 13, 2021
@ALTree ALTree added this to the Go1.18 milestone Dec 13, 2021
@ALTree
Copy link
Member

ALTree commented Dec 13, 2021

Thanks for the reduced reproducer.

cc @danscales

@danscales danscales self-assigned this Dec 13, 2021
@danscales
Copy link
Contributor

I'm still analyzing, but I don't currently think this needs to be a beta release blocker.

@gopherbot
Copy link

Change https://golang.org/cl/371414 mentions this issue: cmd/compile: avoid re-instantiating method that is already imported

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants