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: two final stores on ssa/check #58161

Closed
ALTree opened this issue Jan 31, 2023 · 4 comments
Closed

cmd/compile: internal compiler error: two final stores on ssa/check #58161

ALTree opened this issue Jan 31, 2023 · 4 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@ALTree
Copy link
Member

ALTree commented Jan 31, 2023

$ gotip version
go version devel go1.21-f66581ead6 Tue Jan 31 07:55:26 2023 +0000 linux/amd64
package main

func F[G int]() int {
	return len(make([]int, copy([]G{}, []G{})))
}

func main() {
	F[int]()
}
$ GOARCH=s390x gotip build -gcflags=-d=ssa/check/seed=1 crash.go

# command-line-arguments
./crash.go:3:6: internal compiler error: 'F[int]': two final stores - simultaneous live stores v62 = MakeResult <mem> v58 v56 = StaticCall <mem> {AuxCall{runtime.makeslice}} [32] v17

goroutine 1 [running]:
runtime/debug.Stack()
	./gotip/src/runtime/debug/stack.go:24 +0x5e
cmd/compile/internal/base.FatalfAt({0x403680?, 0xc0?}, {0xc00002d580, 0x37}, {0xc00042e720, 0x3, 0x3})
	./gotip/src/cmd/compile/internal/base/print.go:227 +0x1d7
cmd/compile/internal/base.Fatalf(...)
	./gotip/src/cmd/compile/internal/base/print.go:196
cmd/compile/internal/ssagen.(*ssafn).Fatalf(0x0?, {0x765cb928?, 0x7fc0?}, {0xd58b0a, 0x31}, {0xc000420380, 0x2, 0x0?})
	./gotip/src/cmd/compile/internal/ssagen/ssa.go:7832 +0x16a
cmd/compile/internal/ssa.(*Func).Fatalf(0xc00040c1c0, {0xd58b0a, 0x31}, {0xc000420380, 0x2, 0x2})
	./gotip/src/cmd/compile/internal/ssa/func.go:722 +0x288
cmd/compile/internal/ssa.(*Block).Fatalf(...)
	./gotip/src/cmd/compile/internal/ssa/block.go:412
cmd/compile/internal/ssa.dse(0xc00040c1c0)
	./gotip/src/cmd/compile/internal/ssa/deadstore.go:67 +0x6c5
cmd/compile/internal/ssa.Compile(0xc00040c1c0)
	./gotip/src/cmd/compile/internal/ssa/compile.go:97 +0x95e
cmd/compile/internal/ssagen.buildssa(0xc0003f23c0, 0x0)
	./gotip/src/cmd/compile/internal/ssagen/ssa.go:572 +0x2007
cmd/compile/internal/ssagen.Compile(0xc0003f23c0, 0x13d0520?)
	./gotip/src/cmd/compile/internal/ssagen/pgen.go:185 +0x45
cmd/compile/internal/gc.compileFunctions.func5.1(0x7fc0765c2101?)
	./gotip/src/cmd/compile/internal/gc/compile.go:171 +0x35
cmd/compile/internal/gc.compileFunctions.func2(0xc0004201c0?)
	./gotip/src/cmd/compile/internal/gc/compile.go:125 +0x19
cmd/compile/internal/gc.compileFunctions.func5({0xc000420180, 0x3, 0x4?})
	./gotip/src/cmd/compile/internal/gc/compile.go:170 +0x62
cmd/compile/internal/gc.compileFunctions()
	./gotip/src/cmd/compile/internal/gc/compile.go:181 +0x1ef
cmd/compile/internal/gc.Main(0xd66af8)
	./gotip/src/cmd/compile/internal/gc/main.go:326 +0x136a
main.main()
	./gotip/src/cmd/compile/main.go:57 +0xdd

Doesn't crash on go1.19.5.

@ALTree ALTree added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. arch-s390x Issues solely affecting the s390x architecture. labels Jan 31, 2023
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 31, 2023
@ALTree ALTree changed the title cmd/compile: internal compiler error on ssa/check on s390x cmd/compile: internal compiler error: two final stores on ssa/check on s390x Jan 31, 2023
@randall77
Copy link
Contributor

Very likely this is https://go-review.googlesource.com/c/go/+/454036 . I don't think the clobberIfDead logic is quite right in this case. It leaves the original makeslice call intact.
@Jorropo

@gopherbot
Copy link

Change https://go.dev/cl/463996 mentions this issue: cmd/compile: fix empty makeslice to zerobase rewrite rules

@gopherbot
Copy link

Change https://go.dev/cl/463846 mentions this issue: cmd/compile: use MakeResult in MakeSlice elimination

@Jorropo
Copy link
Member

Jorropo commented Jan 31, 2023

@randall77 ah indeed, I did not knew Call nodes could be passed to MakeResult. Thx for the ping.
I fixed it there: https://go-review.googlesource.com/c/go/+/463846

@ALTree ALTree changed the title cmd/compile: internal compiler error: two final stores on ssa/check on s390x cmd/compile: internal compiler error: two final stores on ssa/check Feb 2, 2023
@ALTree ALTree removed the arch-s390x Issues solely affecting the s390x architecture. label Feb 2, 2023
@mknyszek mknyszek added this to the Go1.21 milestone Feb 8, 2023
johanbrandhorst pushed a commit to Pryz/go that referenced this issue Feb 12, 2023
This gets eliminated by thoses rules above:
  // for rewriting results of some late-expanded rewrites (below)
  (SelectN [0] (MakeResult x ___)) => x
  (SelectN [1] (MakeResult x y ___)) => y
  (SelectN [2] (MakeResult x y z ___)) => z

Fixes golang#58161

Change-Id: I4fbfd52c72c06b6b3db906bd9910b6dbb7fe8975
Reviewed-on: https://go-review.googlesource.com/c/go/+/463846
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
@golang golang locked and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. 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

5 participants