diff options
| author | Keith Randall <khr@google.com> | 2019-05-28 14:59:23 -0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2019-05-31 21:52:17 +0000 |
| commit | 64c134f90f0cf6d0e55fca93c433b68810d12f12 (patch) | |
| tree | 04b87af962e7137dba2e14c9a09ab7ca8eda1278 /src/errors | |
| parent | c10db03cbe152c0851a0794fe230c4b40bbdbd82 (diff) | |
| download | go-64c134f90f0cf6d0e55fca93c433b68810d12f12.tar.xz | |
cmd/compile: don't move nil checks across a VarDef
We need to make sure that there's no possible faulting
instruction between a VarDef and that variable being
fully initialized. If there was, then anything scanning
the stack during the handling of that fault will see
a live but uninitialized variable on the stack.
If we have:
NilCheck p
VarDef x
x = *p
We can't rewrite that to
VarDef x
NilCheck p
x = *p
Particularly, even though *p faults on p==nil, we still
have to do the explicit nil check before the VarDef.
Fixes #32288
Change-Id: Ib8b88e6a5af3bf6f238ff5491ac86f53f3cf9fc9
Reviewed-on: https://go-review.googlesource.com/c/go/+/179239
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Josh Bleecher Snyder <josharian@gmail.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Diffstat (limited to 'src/errors')
0 files changed, 0 insertions, 0 deletions
