diff options
author | Alexey Naidonov <alexey.naidyonov@gmail.com> | 2018-08-28 00:39:34 +0300 |
---|---|---|
committer | Keith Randall <khr@golang.org> | 2018-09-04 17:44:14 +0000 |
commit | 669fa8f36a298cc0e2d1f817ca30c8d613ce7483 (patch) | |
tree | d982f3fc4a3bb833b4cf0d81ccbe8f7a697eabab /test/nilptr3.go | |
parent | 24e51bbe64b4a534b096a3b0c6bfae6a732eea59 (diff) | |
download | go-669fa8f36a298cc0e2d1f817ca30c8d613ce7483.tar.gz go-669fa8f36a298cc0e2d1f817ca30c8d613ce7483.zip |
cmd/compile: remove unnecessary nil-check
Removes unnecessary nil-check when referencing offset from an
address. Suggested by Keith Randall in golang/go#27180.
Updates golang/go#27180
Change-Id: I326ed7fda7cfa98b7e4354c811900707fee26021
Reviewed-on: https://go-review.googlesource.com/131735
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/nilptr3.go')
-rw-r--r-- | test/nilptr3.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/nilptr3.go b/test/nilptr3.go index a22e60ef11..6aa718e027 100644 --- a/test/nilptr3.go +++ b/test/nilptr3.go @@ -246,8 +246,8 @@ type TT struct { func f(t *TT) *byte { // See issue 17242. - s := &t.SS // ERROR "removed nil check" - return &s.x // ERROR "generated nil check" + s := &t.SS // ERROR "generated nil check" + return &s.x // ERROR "removed nil check" } // make sure not to do nil check for newobject |