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: Type.Elem UNSAFEPTR #30254

Closed
LastPossum opened this issue Feb 15, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@LastPossum
Copy link

commented Feb 15, 2019

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

$ go version
go version go1.11.5 darwin/amd64

Does this issue reproduce with the latest release?

It's latest release

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

go env Output
$ go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/egartman/Library/Caches/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/egartman/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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=/var/folders/mv/gfk793qd08b1kj0qcxt5cf_40000gn/T/go-build087446295=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Ran this test:

package main

import (
	"reflect"
	"testing"
	"unsafe"
)

//go:linkname memmove runtime.memmove
func memmove(to, from unsafe.Pointer, n uintptr)

func TestMemmove(t *testing.T) {
	from := []byte{1, 2, 3, 4, 5}
	to := []byte{7, 7, 7, 7, 7}
	want := []byte{7, 1, 2, 3, 7}
	memmove(unsafe.Pointer(&to[1]), unsafe.Pointer(&from[1]), uintptr(3))
	if !reflect.DeepEqual(to, want) {
		t.Fatalf("unexpected %v, want %v", to, want)
	}
}

What did you expect to see?

Test running

What did you see instead?

:1: internal compiler error: Type.Elem UNSAFEPTR

@bcmills

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

Does this issue reproduce with go1.12rc1?

@bcmills bcmills changed the title internal compiler error: Type.Elem UNSAFEPTR cmd/compile: internal compiler error: Type.Elem UNSAFEPTR Feb 15, 2019

@bcmills

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

@bcmills bcmills added this to the Go1.13 milestone Feb 15, 2019

@LastPossum

This comment has been minimized.

Copy link
Author

commented Feb 15, 2019

Does this issue reproduce with go1.12rc1?

No. It works fine.

> go version
go version go1.12rc1 darwin/amd64

> go test
--- FAIL: TestMemmove (0.00s)
    memmove_test.go:18: unexpected [7 2 3 4 7], want [7 1 2 3 7]
FAIL
exit status 1
FAIL    testing.fun/unescape    0.005s
@mvdan

This comment has been minimized.

Copy link
Member

commented Feb 15, 2019

Duplicate of #30061, it seems. If you'd like it backported to 1.11, leave a comment there.

@mvdan mvdan closed this Feb 15, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.