diff options
author | Matthew Dempsky <mdempsky@google.com> | 2019-04-01 11:58:33 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-04-02 16:34:03 +0000 |
commit | abefcac10a635c5c6afdeada810f4663e6cb6f17 (patch) | |
tree | 1361a49965e3c1d19795abfc1734d3b262455ee8 /test/uintptrescapes2.go | |
parent | 4ebc6514faa8530d1a68b4e04f57dc5c25bcb01c (diff) | |
download | go-git-abefcac10a635c5c6afdeada810f4663e6cb6f17.tar.gz |
cmd/compile: skip escape analysis diagnostics for OADDR
For most nodes (e.g., OPTRLIT, OMAKESLICE, OCONVIFACE), escape
analysis prints "escapes to heap" or "does not escape" to indicate
whether that node's allocation can be heap or stack allocated.
These messages are also emitted for OADDR, even though OADDR does not
actually allocate anything itself. Moreover, it's redundant because
escape analysis already prints "moved to heap" diagnostics when an
OADDR node like "&x" causes x to require heap allocation.
Because OADDR nodes don't allocate memory, my escape analysis rewrite
doesn't naturally emit the "escapes to heap" / "does not escape"
diagnostics for them. It's also non-trivial to replicate the exact
semantics esc.go uses for OADDR.
Since there are so many of these messages, I'm disabling them in this
CL by themselves. I modified esc.go to suppress the Warnl calls
without any other behavior changes, and then used a shell script to
automatically remove any ERROR messages mentioned by run.go in
"missing error" or "no match for" lines.
Fixes #16300.
Updates #23109.
Change-Id: I3993e2743c3ff83ccd0893f4e73b366ff8871a57
Reviewed-on: https://go-review.googlesource.com/c/go/+/170319
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'test/uintptrescapes2.go')
-rw-r--r-- | test/uintptrescapes2.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/uintptrescapes2.go b/test/uintptrescapes2.go index 2c8dfd7102..b8117b857b 100644 --- a/test/uintptrescapes2.go +++ b/test/uintptrescapes2.go @@ -30,9 +30,9 @@ func F4(...uintptr) {} // ERROR "escaping ...uintptr" func G() { var t int // ERROR "moved to heap" - F1(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to F1: .?autotmp" "&t escapes to heap" "stack object .autotmp_[0-9]+ unsafe.Pointer$" + F1(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to F1: .?autotmp" "stack object .autotmp_[0-9]+ unsafe.Pointer$" var t2 int // ERROR "moved to heap" - F3(uintptr(unsafe.Pointer(&t2))) // ERROR "live at call to F3: .?autotmp" "&t2 escapes to heap" + F3(uintptr(unsafe.Pointer(&t2))) // ERROR "live at call to F3: .?autotmp" } func H() { |