Skip to content

Commit

Permalink
cmd/compile: enable -d=checkptr when -race or -msan is specified
Browse files Browse the repository at this point in the history
It can still be manually disabled again using -d=checkptr=0.

It's also still disabled by default for GOOS=windows, because the
Windows standard library code has a lot of unsafe pointer conversions
that need updating.

Updates #34964.

Change-Id: Ie0b8b4fdf9761565e0dcb00d69997ad896ac233d
Reviewed-on: https://go-review.googlesource.com/c/go/+/201783
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
  • Loading branch information
mdempsky committed Oct 22, 2019
1 parent 5a5854c commit dded587
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/cmd/compile/internal/gc/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,11 @@ func Main(archInit func(*Arch)) {
if flag_race && flag_msan {
log.Fatal("cannot use both -race and -msan")
}
if (flag_race || flag_msan) && objabi.GOOS != "windows" {
// -race and -msan imply -d=checkptr for now (except on windows).
// TODO(mdempsky): Re-evaluate before Go 1.14. See #34964.
Debug_checkptr = 1
}
if ispkgin(omit_pkgs) {
flag_race = false
flag_msan = false
Expand Down

0 comments on commit dded587

Please sign in to comment.