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: panic: builtins.go: assertion failed #61486

Closed
ALTree opened this issue Jul 20, 2023 · 6 comments
Closed
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jul 20, 2023

$ go version
go version go1.21rc3 linux/amd64

$ gotip version
go version devel go1.22-cac6959 Thu Jul 20 17:51:31 2023 +0000 linux/amd64
package main

func main() {
	var u uint
	_ = min(7 >> u)
}
$ gotip build crash.go 
# command-line-arguments
<unknown line number>: internal compiler error: panic: ./desktop/gotip/src/cmd/compile/internal/types2/builtins.go:1016: assertion failed

goroutine 1 [running]:
runtime/debug.Stack()
	./desktop/gotip/src/runtime/debug/stack.go:24 +0x5e
cmd/compile/internal/base.FatalfAt({0x21d800?, 0x0?}, {0xd6cfa7, 0x9}, {0xc0001374d8, 0x1, 0x1})
	./desktop/gotip/src/cmd/compile/internal/base/print.go:230 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	./desktop/gotip/src/cmd/compile/internal/base/print.go:199
cmd/compile/internal/gc.handlePanic()
	./desktop/gotip/src/cmd/compile/internal/gc/main.go:52 +0x90
panic({0xccae60?, 0xc000036750?})
	./desktop/gotip/src/runtime/panic.go:914 +0x21f
cmd/compile/internal/types2.(*Checker).handleBailout(0xc000404000, 0xc0001391a8)
	./desktop/gotip/src/cmd/compile/internal/types2/check.go:327 +0x88
panic({0xccae60?, 0xc000036750?})
	./desktop/gotip/src/runtime/panic.go:914 +0x21f
cmd/compile/internal/types2.assert(0x10?)
	./desktop/gotip/src/cmd/compile/internal/types2/errors.go:27 +0x54
cmd/compile/internal/types2.makeSig({0xec75e0?, 0x13a2960?}, {0xc000036720, 0x1, 0xc0003e1f20?})
	./desktop/gotip/src/cmd/compile/internal/types2/builtins.go:1016 +0x2e5
cmd/compile/internal/types2.(*Checker).builtin(0xc000404000, 0xc0003f3b80, 0xc00012a930, 0xb)
	./desktop/gotip/src/cmd/compile/internal/types2/builtins.go:591 +0x4a71
cmd/compile/internal/types2.(*Checker).callExpr(0xc000404000, 0xc0003f3b80, 0xc00012a930)
	./desktop/gotip/src/cmd/compile/internal/types2/call.go:230 +0xd1d
cmd/compile/internal/types2.(*Checker).exprInternal(0xc000404000, {0x0?, 0x0?}, 0xc0003f3b80, {0xec9a00?, 0xc00012a930?}, {0x0?, 0x0?})
	./desktop/gotip/src/cmd/compile/internal/types2/expr.go:1380 +0x23bc
cmd/compile/internal/types2.(*Checker).rawExpr(0xc000404000, {0x0, 0x0}, 0xc0003f3b80, {0xec9a00?, 0xc00012a930?}, {0x0?, 0x0?}, 0x0)
	./desktop/gotip/src/cmd/compile/internal/types2/expr.go:980 +0x1ca

...

cc @golang/compiler

@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 20, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 20, 2023
@griesemer griesemer self-assigned this Jul 20, 2023
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/511657 mentions this issue: go/types, types2: make sure info recording is executed in test runs

gopherbot pushed a commit that referenced this issue Jul 20, 2023
Issue #61486 causes a compiler crash but is not detected when running
stand-alone type-checker tests because no types are recorded.

Set up Config.Info map with all maps when when running local tests
so that type/object recording code is executed during local tests.

For #61486.

Change-Id: I8eb40c8525dac3da65db0dc7e0e654842713b9a9
Reviewed-on: https://go-review.googlesource.com/c/go/+/511657
Auto-Submit: Robert Griesemer <gri@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Robert Griesemer <gri@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/511835 mentions this issue: go/types, types2: a min/max value argument must not be untyped

@griesemer
Copy link
Contributor

We probably want to have this fix for 1.21.
It's not critical as this is somewhat unusual code, but at the same time this fixes a real bug and the fix is very specific to min/max only, which is new functionality. So it's not going to break existing code.
Marking as release blocker simply so we can track the cherry-pick.

@griesemer griesemer added this to the Go1.21 milestone Jul 20, 2023
@griesemer griesemer added NeedsFix The path to resolution is known, but the work has not been done. release-blocker and removed NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 20, 2023
@mdempsky
Copy link
Contributor

@gopherbot Please backport to Go 1.21. As @griesemer mentions, "It's not critical as this is somewhat unusual code, but at the same time this fixes a real bug and the fix is very specific to min/max only, which is new functionality. So it's not going to break existing code."

@gopherbot
Copy link
Contributor

Backport issue(s) opened: #61492 (for 1.21).

Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.

@cherrymui
Copy link
Member

As mentioned in https://groups.google.com/g/golang-dev/c/FNPk2joOsXs/m/roCc_a4fBAAJ we don't need a backport issue. Just sending a cherry-pick CL would be fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsFix The path to resolution is known, but the work has not been done. release-blocker
Projects
None yet
Development

No branches or pull requests

6 participants