aboutsummaryrefslogtreecommitdiff
path: root/src/encoding
diff options
context:
space:
mode:
authorkhr <khr@khr-glaptop.roam.corp.google.com>2017-03-09 10:38:45 -0800
committerKeith Randall <khr@golang.org>2017-03-13 19:39:15 +0000
commita51e4cc9cea152a203ab508197dc0965c00e3a76 (patch)
treef7fa6e80cd35b0e0ab2f1d749af39fe60756dc74 /src/encoding
parent27492a2a549e4e03a6aed93811cdd458ce529e32 (diff)
downloadgo-a51e4cc9cea152a203ab508197dc0965c00e3a76.tar.xz
cmd/compile: zero return parameters earlier
Move the zeroing of results earlier. In particular, they need to come before any move-to-heap operations, as those require allocation. Those allocations are points at which the GC can see the uninitialized result slots. For the function: func f() (x, y, z *int) { defer(){}() escape(&y) return } We used to generate code like this: x = nil y = nil &y = new(int) z = nil Now we will generate: x = nil y = nil z = nil &y = new(int) Since the fix for #18860, the return slots are always live if there is a defer, so the former ordering allowed the GC to see junk in the z slot. Fixes #19078 Change-Id: I71554ae437549725bb79e13b2c100b2911d47ed4 Reviewed-on: https://go-review.googlesource.com/38133 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'src/encoding')
0 files changed, 0 insertions, 0 deletions