go/test/fixedbugs
khr a51e4cc9ce 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>
2017-03-13 19:39:15 +00:00
..
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:48:57 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-12-13 15:11:31 -08:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2014-07-16 19:27:10 -04:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:30 -05:00
2013-06-20 08:21:14 +02:00
2012-08-25 10:16:02 +02:00
2012-08-25 10:16:02 +02:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2012-02-18 22:15:42 +01:00
2015-07-11 14:36:33 +00:00
2012-08-25 10:16:02 +02:00
2012-09-28 08:30:30 -07:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:30 -05:00
2012-02-16 23:49:59 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:59 -05:00
2012-02-16 23:49:59 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:59 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:59 -05:00
2012-02-16 23:49:59 -05:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:59 -05:00
2012-02-16 23:49:59 -05:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:49:59 -05:00
2012-02-16 23:49:59 -05:00
2012-02-16 23:49:59 -05:00
2012-08-25 10:16:02 +02:00
2012-02-16 23:50:37 -05:00
2012-02-18 22:15:42 +01:00
2012-02-16 23:50:37 -05:00
2015-07-11 14:36:33 +00:00
2015-07-11 14:36:33 +00:00
2012-09-28 08:30:30 -07:00
2013-12-12 17:18:12 -08:00
2013-12-12 17:18:12 -08:00
2013-12-12 17:18:12 -08:00
2013-03-15 09:03:45 +01:00
2013-12-12 17:18:12 -08:00
2013-06-28 23:08:07 +02:00
2016-04-25 19:20:40 +00:00
2016-05-08 22:59:43 +00:00
2016-09-04 00:15:41 +00:00
2016-12-08 23:22:37 +00:00
2016-10-12 14:57:26 +00:00