diff options
author | Cherry Zhang <cherryyz@google.com> | 2016-09-28 10:20:24 -0400 |
---|---|---|
committer | Cherry Zhang <cherryyz@google.com> | 2016-09-28 19:41:49 +0000 |
commit | 4d07d3e29c467484801b84dfeb762d2ee00979a9 (patch) | |
tree | 0688bb491e6e0dd83e151e058565dc45699669df /test/nilptr3.go | |
parent | 456a01ac47c1473d6b241c56eb8db0cb832d9be2 (diff) | |
download | go-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.go | 7 |
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" +} |