aboutsummaryrefslogtreecommitdiff
path: root/test/nilptr3.go
diff options
context:
space:
mode:
authorCherry Zhang <cherryyz@google.com>2016-09-28 10:20:24 -0400
committerCherry Zhang <cherryyz@google.com>2016-09-28 19:41:49 +0000
commit4d07d3e29c467484801b84dfeb762d2ee00979a9 (patch)
tree0688bb491e6e0dd83e151e058565dc45699669df /test/nilptr3.go
parent456a01ac47c1473d6b241c56eb8db0cb832d9be2 (diff)
downloadgo-4d07d3e29c467484801b84dfeb762d2ee00979a9.tar.gz
go-4d07d3e29c467484801b84dfeb762d2ee00979a9.zip
cmd/compile: re-enable nilcheck removal for newobject
Also add compiler debug ouput and add a test. Fixes #15390. Change-Id: Iceba1414c29bcc213b87837387bf8ded1f3157f1 Reviewed-on: https://go-review.googlesource.com/30011 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/nilptr3.go')
-rw-r--r--test/nilptr3.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/nilptr3.go b/test/nilptr3.go
index b965cd262d..8fdae8c075 100644
--- a/test/nilptr3.go
+++ b/test/nilptr3.go
@@ -247,3 +247,10 @@ func f(t *TT) *byte {
s := &t.SS // ERROR "removed nil check"
return &s.x // ERROR "generated nil check"
}
+
+// make sure not to do nil check for newobject
+func f7() (*Struct, float64) {
+ t := new(Struct)
+ p := &t.Y // ERROR "removed nil check"
+ return t, *p // ERROR "removed nil check"
+}