diff options
author | Matthew Dempsky <mdempsky@google.com> | 2017-12-07 23:04:50 -0800 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2017-12-08 21:34:24 +0000 |
commit | 840fad13ecd974efebe4fa25d4e444df5ec8041d (patch) | |
tree | 2662fa60586d55bbceca86e3992bf2de212c5893 /test/live_syscall.go | |
parent | a9410281c2bcf7f56e6fd4bb409559ae362fe8c6 (diff) | |
download | go-840fad13ecd974efebe4fa25d4e444df5ec8041d.tar.gz go-840fad13ecd974efebe4fa25d4e444df5ec8041d.zip |
cmd/compile: fix unsafe.Pointer liveness for Syscall-like functions
The package unsafe docs say it's safe to convert an unsafe.Pointer to
uintptr in the argument list to an assembly function, but it was
erroneously only detecting normal pointers converted to unsafe.Pointer
and then to intptr.
Fixes #23051.
Change-Id: Id1be19f6d8f26f2d17ba815191717d2f4f899732
Reviewed-on: https://go-review.googlesource.com/82817
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Diffstat (limited to 'test/live_syscall.go')
-rw-r--r-- | test/live_syscall.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/live_syscall.go b/test/live_syscall.go index f693e9357a..6d954653cc 100644 --- a/test/live_syscall.go +++ b/test/live_syscall.go @@ -26,3 +26,15 @@ func h() { var v int syscall.Syscall(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to Syscall: .?autotmp" "h &v does not escape" } + +func i() { + var t int + p := unsafe.Pointer(&t) // ERROR "i &t does not escape" + f(uintptr(p)) // ERROR "live at call to f: .?autotmp" +} + +func j() { + var v int + p := unsafe.Pointer(&v) // ERROR "j &v does not escape" + syscall.Syscall(0, 1, uintptr(p), 2) // ERROR "live at call to Syscall: .?autotmp" +} |