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: ICE: 'NameCon': not lowered: v502, Load INTER PTR SSA #42784

Closed
dmgk opened this issue Nov 23, 2020 · 4 comments
Closed

cmd/compile: ICE: 'NameCon': not lowered: v502, Load INTER PTR SSA #42784

dmgk opened this issue Nov 23, 2020 · 4 comments

Comments

@dmgk
Copy link
Contributor

@dmgk dmgk commented Nov 23, 2020

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

$ go version
go version devel +d902791b50 Mon Nov 23 05:57:35 2020 +0000 freebsd/amd64

Does this issue reproduce with the latest release?

No, tip only.

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

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/dmgk/.cache/go-build"
GOENV="/home/dmgk/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="freebsd"
GOINSECURE=""
GOMODCACHE="/home/dmgk/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="freebsd"
GOPATH="/home/dmgk/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/dmgk/opt/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/dmgk/opt/go/pkg/tool/freebsd_amd64"
GOVCS=""
GOVERSION="devel +d902791b50 Mon Nov 23 05:57:35 2020 +0000"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build206452789=/tmp/go-build -gno-record-gcc-switches"
GOROOT/bin/go version: go version devel +d902791b50 Mon Nov 23 05:57:35 2020 +0000 freebsd/amd64
GOROOT/bin/go tool compile -V: compile version devel +d902791b50 Mon Nov 23 05:57:35 2020 +0000
uname -v: FreeBSD 12.2-STABLE r367758 XOMBO
lldb --version: lldb version 10.0.1 (git@github.com:llvm/llvm-project.git revision llvmorg-10.0.1-0-gef32c611aa2)
  clang revision llvmorg-10.0.1-0-gef32c611aa2
  llvm revision llvmorg-10.0.1-0-gef32c611aa2
gdb --version: GNU gdb (GDB) 9.2 [GDB v9.2 for FreeBSD]

What did you do?

go get github.com/MichaelMure/git-bug@0.7.1

What did you expect to see?

go get completing without errors.

What did you see instead?

$ go get github.com/MichaelMure/git-bug@0.7.1
# github.com/MichaelMure/git-bug/graphql/connections
go/pkg/mod/github.com/!michael!mure/git-bug@v0.0.0-20200404104824-2d64b85db71a/graphql/connections/connection_template.go:46:10: internal compiler error: 'NameCon': not lowered: v502, Load INTER PTR SSA

goroutine 29 [running]:
runtime/debug.Stack(0xdb70e0, 0xc0000c0008, 0x0)
        /home/dmgk/opt/go/src/runtime/debug/stack.go:24 +0x9f
cmd/compile/internal/gc.Fatalf(0xc000a25e30, 0x8, 0xc0004a7060, 0x2, 0x2)
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/subr.go:199 +0x1b0
cmd/compile/internal/gc.(*ssafn).Fatalf(0xc0005145a0, 0x2e0a000000002, 0xc924a3, 0x2, 0xc000b6fcd0, 0x1, 0x1)
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/ssa.go:7105 +0x1a5
cmd/compile/internal/ssa.(*Func).Fatalf(...)
        /home/dmgk/opt/go/src/cmd/compile/internal/ssa/func.go:652
cmd/compile/internal/ssa.checkLower(0xc0004ed080)
        /home/dmgk/opt/go/src/cmd/compile/internal/ssa/lower.go:36 +0x41a
cmd/compile/internal/ssa.Compile(0xc0004ed080)
        /home/dmgk/opt/go/src/cmd/compile/internal/ssa/compile.go:96 +0x98d
cmd/compile/internal/gc.buildssa(0xc000490420, 0x1, 0x0)
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/ssa.go:469 +0x11ba
cmd/compile/internal/gc.compileSSA(0xc000490420, 0x1)
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/pgen.go:319 +0x5d
cmd/compile/internal/gc.compileFunctions.func2(0xc00006a4e0, 0xc00052e1a0, 0x1)
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/pgen.go:384 +0x4d
created by cmd/compile/internal/gc.compileFunctions
        /home/dmgk/opt/go/src/cmd/compile/internal/gc/pgen.go:382 +0x129

See also #42727

@randall77
Copy link
Contributor

@randall77 randall77 commented Nov 23, 2020

Loading

@cuonglm
Copy link
Member

@cuonglm cuonglm commented Nov 23, 2020

Small reproducer:

package p

type iface interface {
	m()
}

type it interface{}

type makeIface func() iface

func f() {
	var im makeIface
	e := im().(it)
	g(e)
}

//go:noinline
func g(i it) {}

expand_calls phase somehow generates:

v10 (?) = Addr <*uint8> {type."".it} v3
v16 (13) = SP <uintptr>
v14 (?) = OffPtr <*uintptr> [0] v16
v9 (?) = OffPtr <**uint8> [8] v16
v24 (?) = OffPtr <**uint8> [0] v16
v29 (?) = OffPtr <**uint8> [16] v16
v31 (?) = OffPtr <*it> [8] v16
v32 (13) = Load <it> v31 v6
v11 (13) = Load <*uint8> v24 v6

Loading

@ALTree ALTree added this to the Go1.16 milestone Nov 23, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Nov 23, 2020

Change https://golang.org/cl/272466 mentions this issue: cmd/compile: set OpLoad argument type interface{} correctly

Loading

@gopherbot gopherbot closed this in 7dc5d90 Nov 24, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 10, 2020

Change https://golang.org/cl/276952 mentions this issue: cmd/compile: set correct type for OpIData

Loading

gopherbot pushed a commit that referenced this issue Dec 14, 2020
Since CL 270057, there're many attempts to fix the expand_calls pass
with interface{}-typed. But all of them did not fix the root cause. The
main issue is during SSA conversion in gc/ssa.go, for empty interface
case, we make its type as n.Type, instead of BytePtr.

To fix these, we can just use BytePtr for now, since when itab fields
are treated as scalar.

No significal changes on compiler speed, size.

cmd/compile/internal/ssa
expandCalls.func6 9488 -> 9232  (-2.70%)

file                       before   after    Δ       %
cmd/compile/internal/ssa.s 3992893  3992637  -256    -0.006%
total                      20500447 20500191 -256    -0.001%

Fixes #43112
Updates #42784
Updates #42727
Updates #42568

Change-Id: I0b15d9434e0be5448453e61f98ef9c2d6cd93792
Reviewed-on: https://go-review.googlesource.com/c/go/+/276952
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants