Running the race detector will turn on the checkptr check. Which is good but will result in a
panic in projects that convert uintptr to unsafe.Pointer in a suspicious manner. An example
of such a project is go-gl.
If we still want to run the race check we can get around the problem by turning off checkptr:
go run -race -gcflags=all=-d=checkptr=0 .
If we don't turn it off, we see a panic:
fatal error: checkptr: pointer arithmetic computed bad pointer value
We see this in every version of Go since checkptr was introduced. This is fine and exactly
the behaviour we would expect.
However, in the current development tree. Setting checkptr=0 has no effect and we see the same panic as we
would if we didn't turn off the check. In other words,
go run -race .
is the same as
go run -race -gcflags=all=-d=checkptr=0 .
The simplest reproducible example I know of is the imgui-go-examples project:
From the "cmd/example_sdl_opengl3" directory:
go run -race -gcflags=all=-d=checkptr=0 -tags='sdl' .
will cause the panic when using the development compiler but not when using 1.16 etc.
Stephen