]> Cypherpunks repositories - gostls13.git/commit
all: fix most of the remaining windows -d=checkptr violations
authorAlex Brainman <alex.brainman@gmail.com>
Sat, 9 Nov 2019 08:06:24 +0000 (19:06 +1100)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 6 Dec 2019 05:10:34 +0000 (05:10 +0000)
commit6ef7794b24f7c8890c673436d8509b83def2ce27
tree17f430d87e42cc8e65001829f057420b68dc42ad
parentb81e01dc2ee9cb586b971f6a86cf0f32a0af69ba
all: fix most of the remaining windows -d=checkptr violations

This change replaces

buf := [HUGE_CONST]*T)(unsafe.Pointer(p))[:]

with

buf := [HUGE_CONST]*T)(unsafe.Pointer(p))[:n:n]

Pointer p points to n of T elements. New unsafe pointer conversion
logic verifies that both first and last elements point into the same
Go variable.

This change replaces [:] with [:n:n] to please pointer checker.
According to @mdempsky, compiler specially recognizes when you
combine a pointer conversion with a full slice operation in a single
expression and makes an exception.

After this, only one failure in net remains when running:

go test -a -short -gcflags=all=-d=checkptr std cmd

Updates #34972

Change-Id: I2c8731650c856264bc788e4e07fa0530f7c250fa
Reviewed-on: https://go-review.googlesource.com/c/go/+/208617
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
src/go/build/deps_test.go
src/internal/syscall/windows/reparse_windows.go
src/internal/syscall/windows/syscall_windows.go
src/net/interface_windows.go
src/net/lookup_windows.go
src/os/env_windows.go
src/os/exec_windows.go
src/os/os_windows_test.go
src/os/user/lookup_windows.go
src/syscall/security_windows.go
src/syscall/syscall_windows.go