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
Closed

cmd/compile: internal compiler error: Type.Elem UNSAFEPTR #30254

LastPossum opened this issue Feb 15, 2019 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@LastPossum
Copy link

LastPossum 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
Copy link
Contributor

bcmills 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
Copy link
Contributor

bcmills commented Feb 15, 2019

CC @randall77 @griesemer

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 15, 2019
@bcmills bcmills added this to the Go1.13 milestone Feb 15, 2019
@bcmills bcmills added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 15, 2019
@LastPossum
Copy link
Author

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
Copy link
Member

mvdan 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 as completed Feb 15, 2019
@golang golang locked and limited conversation to collaborators Feb 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants