You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
odeke-em
changed the title
Internal compiler error
cmd/compile: ICE in SSA when make is invoked with negative value instead of runtime panic about "len out of range"
Dec 24, 2019
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, it does
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I compiled the code below:
What did you expect to see?
rotate(a0[:], -3)
is unsafe because it can result in callingmake
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:
The text was updated successfully, but these errors were encountered: