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

runtime: checkptr incorrectly -race flagging when using &^ arithmetic [1.14 backport] #40968

Closed
dmitshur opened this issue Aug 21, 2020 · 4 comments
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Milestone

Comments

@dmitshur
Copy link
Contributor

@dmitshur requested issue #40917 to be considered for backport to the next 1.14 minor release. (The original issue exists in 1.14 too, so per backport policy, it must be considered for backporting to both 1.15 and 1.14.)

See the corresponding 1.15 backport issue #40934 for more details.

/cc @mdempsky

@dmitshur dmitshur added the CherryPickCandidate Used during the release process for point releases label Aug 21, 2020
@dmitshur dmitshur added this to the Go1.14.8 milestone Aug 21, 2020
@dmitshur dmitshur added CherryPickApproved Used during the release process for point releases and removed CherryPickCandidate Used during the release process for point releases labels Aug 21, 2020
@dmitshur
Copy link
Contributor Author

Approved per discussion in a release meeting. This backport applies to both 1.15 (#40934) and 1.14 (this issue).

@mdempsky Could you please send a CL for this too?

@mdempsky
Copy link
Member

Sure.

@gopherbot
Copy link

Change https://golang.org/cl/249838 mentions this issue: [release-branch.go1.14] cmd/compile: fix checkptr handling of &^

@gopherbot
Copy link

Closed by merging 24dbf3e to release-branch.go1.14.

gopherbot pushed a commit that referenced this issue Aug 21, 2020
checkptr has code to recognize &^ expressions, but it didn't take into
account that "p &^ x" gets rewritten to "p & ^x" during walk, which
resulted in false positive diagnostics.

This CL changes walkexpr to mark OANDNOT expressions with Implicit
when they're rewritten to OAND, so that walkCheckPtrArithmetic can
still recognize them later.

It would be slightly more idiomatic to instead mark the OBITNOT
expression as Implicit (as it's a compiler-generated Node), but the
OBITNOT expression might get constant folded. It's not worth the extra
complexity/subtlety of relying on n.Right.Orig, so we set Implicit on
the OAND node instead.

To atone for this transgression, I add documentation for nodeImplicit.

Updates #40917.
Fixes #40968.

Change-Id: I386304171ad299c530e151e5924f179e9a5fd5b8
Reviewed-on: https://go-review.googlesource.com/c/go/+/249477
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/249838
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@dmitshur dmitshur modified the milestones: Go1.14.8, Go1.14.9 Sep 1, 2020
@golang golang locked and limited conversation to collaborators Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CherryPickApproved Used during the release process for point releases FrozenDueToAge
Projects
None yet
Development

No branches or pull requests

3 participants