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

fatal error: checkptr: unsafe pointer arithmetic on Go 1.14rc1 #72

Closed
jonathaningram opened this issue Feb 6, 2020 · 1 comment · Fixed by #75
Closed

fatal error: checkptr: unsafe pointer arithmetic on Go 1.14rc1 #72

jonathaningram opened this issue Feb 6, 2020 · 1 comment · Fixed by #75

Comments

@jonathaningram
Copy link

Testing Go 1.14rc1 and building the examples with -race panics as below. This is caused by a new checker in 1.14 as described in https://tip.golang.org/doc/go1.14#compiler.

$ # checkout repo
$ cd gl41core-cube
$ go1.14rc1 build -race
$ ./gl41core-cube 
OpenGL version 4.1 INTEL-12.10.16
fatal error: checkptr: unsafe pointer arithmetic
goroutine 1 [running, locked to thread]:
runtime.throw(0x423c365, 0x23)
	/Users/me/sdk/go1.14rc1/src/runtime/panic.go:1112 +0x72 fp=0xc00014fc60 sp=0xc00014fc30 pc=0x4031f32
runtime.checkptrArithmetic(0xc, 0x0, 0x0, 0x0)
	/Users/me/sdk/go1.14rc1/src/runtime/checkptr.go:24 +0xce fp=0xc00014fc90 sp=0xc00014fc60 pc=0x40085ee
github.com/go-gl/gl/v4.1-core/gl.PtrOffset(...)
	/Users/me/go/src/github.com/go-gl/gl/v4.1-core/gl/conversions.go:55
main.main()
	/tmp/go-gl/example/gl41core-cube/cube.go:103 +0x110a fp=0xc00014ff88 sp=0xc00014fc90 pc=0x41656da
runtime.main()
	/Users/me/sdk/go1.14rc1/src/runtime/proc.go:203 +0x212 fp=0xc00014ffe0 sp=0xc00014ff88 pc=0x4034582
runtime.goexit()
	/Users/me/sdk/go1.14rc1/src/runtime/asm_amd64.s:1375 +0x1 fp=0xc00014ffe8 sp=0xc00014ffe0 pc=0x40606f1

gl.VertexAttribPointer(texCoordAttrib, 2, gl.FLOAT, false, 5*4, gl.PtrOffset(3*4))

I only had a quick glance at the pointer arithmetic but at a glance it wasn't obvious to me what the fix should be.

Orginally posted in the Gophers Slack channel. cc @dmitshur

@pwaller
Copy link
Member

pwaller commented Feb 7, 2020

Sounds like a possible duplicate of go-gl/gl#80?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants