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: runtime error when clearing empty struct slice #61127

Closed
ALTree opened this issue Jun 30, 2023 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jun 30, 2023

$ gotip version
go version devel go1.21-18e17e2 Thu Jun 29 23:06:46 2023 +0000 linux/amd64

$ go version
go version go1.21rc2 linux/amd64
package main

var V = []struct{}{}

func main() {
	clear(V)
}
$ gotip build crash.go 
# command-line-arguments
./crash.go:6:7: internal compiler error: panic: runtime error: invalid memory address or nil pointer dereference

goroutine 1 [running]:
runtime/debug.Stack()
	./desktop/gotip/src/runtime/debug/stack.go:24 +0x5e
cmd/compile/internal/base.FatalfAt({0x2?, 0x3050?}, {0xd6cf86, 0x9}, {0xc0000ef428, 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({0xcef740?, 0x13a0cb0?})
	./desktop/gotip/src/runtime/panic.go:914 +0x21f
cmd/compile/internal/walk.walkExpr({0xecec78, 0xc00040b1d0}, 0xc0000ef838)
	./desktop/gotip/src/cmd/compile/internal/walk/expr.go:59 +0x2e7
cmd/compile/internal/walk.walkStmt({0xecec78, 0xc00040b1d0?})
	./desktop/gotip/src/cmd/compile/internal/walk/stmt.go:59 +0x87a
cmd/compile/internal/walk.walkStmtList(...)
	./desktop/gotip/src/cmd/compile/internal/walk/stmt.go:175
cmd/compile/internal/walk.Walk(0xc00042b4a0)
	./desktop/gotip/src/cmd/compile/internal/walk/walk.go:43 +0x14d
cmd/compile/internal/gc.prepareFunc(0xc00042b4a0)
	./desktop/gotip/src/cmd/compile/internal/gc/compile.go:105 +0xf9
cmd/compile/internal/gc.enqueueFunc(0xc00042b4a0)
	./desktop/gotip/src/cmd/compile/internal/gc/compile.go:71 +0x307
cmd/compile/internal/gc.Main(0xda4168)
	./desktop/gotip/src/cmd/compile/internal/gc/main.go:338 +0x14dd
main.main()
	./desktop/gotip/src/cmd/compile/main.go:57 +0xf9

Affects both tip and 1.21rc2

cc @griesemer @mdempsky

@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Jun 30, 2023
@ALTree ALTree added this to the Go1.21 milestone Jun 30, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jun 30, 2023
@cagedmantis
Copy link
Contributor

/cc @golang/compiler

@gopherbot
Copy link

Change https://go.dev/cl/507535 mentions this issue: cmd/compile: fix clear on slice with zero size elem

@gopherbot
Copy link

Change https://go.dev/cl/508335 mentions this issue: test: add test cases for index value with range array clear

gopherbot pushed a commit that referenced this issue Jul 10, 2023
Updates #61127

Change-Id: I5fb032c990b64bb4f455a7c0345cfb556bf263bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/508335
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
bradfitz pushed a commit to tailscale/go that referenced this issue Jul 15, 2023
Fixed golang#61127

Change-Id: If07b04ebcc98438c66f273c0c94bea1f230dc2e8
Reviewed-on: https://go-review.googlesource.com/c/go/+/507535
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
bradfitz pushed a commit to tailscale/go that referenced this issue Jul 15, 2023
Updates golang#61127

Change-Id: I5fb032c990b64bb4f455a7c0345cfb556bf263bd
Reviewed-on: https://go-review.googlesource.com/c/go/+/508335
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
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. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker
Projects
None yet
Development

No branches or pull requests

4 participants