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: unexpected type uint for 1 #32959

Closed
zeebo opened this issue Jul 6, 2019 · 4 comments
Closed

cmd/compile: internal compiler error: unexpected type uint for 1 #32959

zeebo opened this issue Jul 6, 2019 · 4 comments

Comments

@zeebo
Copy link
Contributor

@zeebo zeebo commented Jul 6, 2019

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

$ go version
go version devel +9a00e64633 Fri Jul 5 12:11:36 2019 +0000 linux/amd6

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
GO111MODULE="on"
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/jeff/.cache/go-build"
GOENV="/home/jeff/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/jeff/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org"
GOROOT="/home/jeff/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/jeff/gotip/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/jeff/tmp/crash/go.mod"
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 -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build477512344=/tmp/go-build -gno-record-gcc-switches"

What did you do?

package main

import "unsafe"

func main() {
	var l uint64
	var p unsafe.Pointer
	_ = unsafe.Pointer(uintptr(p) + (uintptr(l) >> 1))
}

What did you expect to see?

Successful compilation.

What did you see instead?

# crash
./foo.go:10:20: internal compiler error: unexpected type uint for 1

goroutine 1 [running]:
runtime/debug.Stack(0xfdc4a0, 0xc0000b6008, 0x0)
	/home/jeff/gotip/src/runtime/debug/stack.go:24 +0x9d
cmd/compile/internal/gc.Fatalf(0xe45afa, 0x19, 0xc0003491b8, 0x2, 0x2)
	/home/jeff/gotip/src/cmd/compile/internal/gc/subr.go:188 +0x291
cmd/compile/internal/gc.(*Escape).unsafeValue(0xc0000f2210, 0xc0000f2278, 0x0, 0xc000360d80)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:597 +0x2a7
cmd/compile/internal/gc.(*Escape).unsafeValue(0xc0000f2210, 0xc0000f2278, 0x0, 0xc000360a80)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:619 +0xc8
cmd/compile/internal/gc.(*Escape).unsafeValue(0xc0000f2210, 0xc0000f2278, 0x0, 0xc000360b80)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:619 +0xc8
cmd/compile/internal/gc.(*Escape).exprSkipInit(0xc0000f2210, 0xc0000f2278, 0x0, 0xc000360780)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:480 +0x723
cmd/compile/internal/gc.(*Escape).expr(0xc0000f2210, 0xc0000f2278, 0x0, 0xc000360780)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:414 +0x6a
cmd/compile/internal/gc.(*Escape).assign(0xc0000f2210, 0xc00033d0e0, 0xc000360780, 0xe35d70, 0x6, 0xc000360700)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:702 +0x17b
cmd/compile/internal/gc.(*Escape).stmt(0xc0000f2210, 0xc000360700)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:364 +0x27c
cmd/compile/internal/gc.(*Escape).stmts(0xc0000f2210, 0xc00037c7a0)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:403 +0x58
cmd/compile/internal/gc.(*Escape).walkFunc(0xc0000f2210, 0xc0002e2160)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:204 +0x78
cmd/compile/internal/gc.escapeFuncs(0xc0000b6450, 0x1, 0x1, 0xc0002e4900)
	/home/jeff/gotip/src/cmd/compile/internal/gc/escape.go:145 +0x117
cmd/compile/internal/gc.(*bottomUpVisitor).visit(0xc0003497a8, 0xc0002e2160, 0xbf402d1f18dba43e)
	/home/jeff/gotip/src/cmd/compile/internal/gc/scc.go:118 +0x295
cmd/compile/internal/gc.visitBottomUp(0xc000094a20, 0x2, 0x2, 0xe5b258)
	/home/jeff/gotip/src/cmd/compile/internal/gc/scc.go:58 +0x95
cmd/compile/internal/gc.escapes(...)
	/home/jeff/gotip/src/cmd/compile/internal/gc/esc.go:49
cmd/compile/internal/gc.Main(0xe5b0c8)
	/home/jeff/gotip/src/cmd/compile/internal/gc/main.go:646 +0x2f42
main.main()
	/home/jeff/gotip/src/cmd/compile/main.go:51 +0xac
@agnivade agnivade changed the title cmd/gc: internal compiler error: unexpected type uint for 1 cmd/compile: internal compiler error: unexpected type uint for 1 Jul 6, 2019
@agnivade agnivade added this to the Go1.13 milestone Jul 6, 2019
@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Jul 6, 2019

Marked as release blocker since this is a regression.

@randall77

@agnivade

This comment has been minimized.

Copy link
Contributor

@agnivade agnivade commented Jul 6, 2019

Bisected to 996a687

It passes with -gcflags=all=-newescape=false

@mdempsky @dr2chase

@mdempsky

This comment has been minimized.

Copy link
Member

@mdempsky mdempsky commented Jul 6, 2019

Thanks for the easy repro and bisection, @zeebo @agnivade.

I think the fix is in unsafeValue, for OLSH and ORSH nodes we should call discard(n.Right) instead of unsafeValue(n.Right).

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 7, 2019

Change https://golang.org/cl/185039 mentions this issue: cmd/compile: fix unsafeValue handles OLSH/ORSH wrong

@gopherbot gopherbot closed this in 06ef108 Jul 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.