Personally, I would be inclined to backport a fix for anything that causes false-positives in -race mode. We really don't want to encourage users to discount -race reports as false-positives, or (even worse!) to avoid running the race detector due to false-positives in their dependencies.
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.
Run-TryBot: Matthew Dempsky <firstname.lastname@example.org>
TryBot-Result: Gobot Gobot <email@example.com>
Reviewed-by: Keith Randall <firstname.lastname@example.org>
Reviewed-by: Cuong Manh Le <email@example.com>
(cherry picked from commit e94544c)
Run-TryBot: Dmitri Shuralyov <firstname.lastname@example.org>
Reviewed-by: Matthew Dempsky <email@example.com>