]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: check deferred nil interface call before wrapping it
authorCherry Zhang <cherryyz@google.com>
Mon, 29 Mar 2021 17:44:08 +0000 (13:44 -0400)
committerCherry Zhang <cherryyz@google.com>
Tue, 30 Mar 2021 00:47:22 +0000 (00:47 +0000)
commitbd6628e62dd5ef1e389d6551a83ef4f2baabebb5
treea21d5e425f250a1f71e68fb61aad7987eacbc02a
parent4e1bf8ed3840632b4781d3c4abb4704dca468dd4
cmd/compile: check deferred nil interface call before wrapping it

Currently, for "defer i.M()" if i is nil it panics at the point of
defer statement, not when deferred function is called. We need to
do the nil check before wrapping it.

Updates #40724.

Change-Id: I62c669264668991f71999e2cf4610a9066247f9d
Reviewed-on: https://go-review.googlesource.com/c/go/+/305549
Trust: Cherry Zhang <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Than McIntosh <thanm@google.com>
src/cmd/compile/internal/walk/order.go