-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.
Milestone
Description
What version of Go are you using (go version
)?
$ go version go version go1.13.5 windows/amd64
Does this issue reproduce with the latest release?
Yes, it does
What operating system and processor architecture are you using (go env
)?
go env
Output
$ go env set GO111MODULE= set GOARCH=amd64 set GOBIN= set GOCACHE=D:\Users\hidek\AppData\Local\go-build set GOENV=D:\Users\hidek\AppData\Roaming\go\env set GOEXE=.exe set GOFLAGS= set GOHOSTARCH=amd64 set GOHOSTOS=windows set GONOPROXY= set GONOSUMDB= set GOOS=windows set GOPATH=D:\Users\hidek\go set GOPRIVATE= set GOPROXY=https://proxy.golang.org,direct set GOROOT=D:\Users\hidek\bin\Go set GOSUMDB=sum.golang.org set GOTMPDIR= set GOTOOLDIR=D:\Users\hidek\bin\Go\pkg\tool\windows_amd64 set GCCGO=gccgo set AR=ar set CC=gcc set CXX=g++ set CGO_ENABLED=1 set GOMOD= set CGO_CFLAGS=-g -O2 set CGO_CPPFLAGS= set CGO_CXXFLAGS=-g -O2 set CGO_FFLAGS=-g -O2 set CGO_LDFLAGS=-g -O2 set PKG_CONFIG=pkg-config set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=D:\Users\hidek\AppData\Local\Temp\go-build088172418=/tmp/go-build -gno-record-gcc-switches
What did you do?
I compiled the code below:
package main
import (
"fmt"
)
func rotate(s []int, m int) {
l := len(s)
m = m % l
buf := make([]int, m)
copy(buf, s)
copy(s, s[m:])
copy(s[l-m:], buf)
}
func testRotate() {
a0 := [...]int{1,2,3,4,5}
fmt.Println(a0)
rotate(a0[:], 1)
fmt.Println(a0)
rotate(a0[:], -3)
fmt.Println(a0)
}
func main() {
testRotate()
}
What did you expect to see?
rotate(a0[:], -3)
is unsafe because it can result in calling make
with a negative value. So I expected a runtime error or a meaningful compile error/warning message.
What did you see instead?
I got an internal compiler error:
# command-line-arguments
.\ex4-4.go:21:11: internal compiler error: 'testRotate': not lowered: v281, Move SSA UNSAFEPTR PTR SSA
Please file a bug report including a short program that triggers the error.
https://golang.org/issue/new
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.