aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/runtime-gdb_test.go
diff options
context:
space:
mode:
authorMichael Munday <mike.munday@ibm.com>2017-03-29 14:01:41 -0400
committerMichael Munday <mike.munday@ibm.com>2017-08-24 16:53:56 +0000
commit744ebfde0460e1d8fff10672e4d1e8d9ece52556 (patch)
tree30f9eca8178f7ce2b7534ab394e0e1dac4e42e60 /src/runtime/runtime-gdb_test.go
parent18b48afec9be0a1da4b23bebace0dc9f081dcee1 (diff)
downloadgo-744ebfde0460e1d8fff10672e4d1e8d9ece52556.tar.gz
go-744ebfde0460e1d8fff10672e4d1e8d9ece52556.zip
cmd/compile: eliminate stores to unread auto variables
This is a crude compiler pass to eliminate stores to auto variables that are only ever written to. Eliminates an unnecessary store to x from the following code: func f() int { var x := 1 return *(&x) } Fixes #19765. Change-Id: If2c63a8ae67b8c590b6e0cc98a9610939a3eeffa Reviewed-on: https://go-review.googlesource.com/38746 Run-TryBot: Michael Munday <mike.munday@ibm.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/runtime/runtime-gdb_test.go')
-rw-r--r--src/runtime/runtime-gdb_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/runtime/runtime-gdb_test.go b/src/runtime/runtime-gdb_test.go
index 1318babdea..811d81f961 100644
--- a/src/runtime/runtime-gdb_test.go
+++ b/src/runtime/runtime-gdb_test.go
@@ -84,7 +84,7 @@ func main() {
slicevar := make([]string, 0, 16)
slicevar = append(slicevar, mapvar["abc"])
fmt.Println("hi") // line 13
- _ = ptrvar
+ runtime.KeepAlive(ptrvar)
gslice = slicevar
runtime.KeepAlive(mapvar)
}