diff options
author | LE Manh Cuong <cuong.manhle.vn@gmail.com> | 2019-07-07 23:08:20 +0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2019-07-09 01:49:44 +0000 |
commit | 06ef108cec98b3dfc0fba3f49e733a18eb9badd5 (patch) | |
tree | 6f6398348771a24e410e19ea1282b68a6e8575bd /test/fixedbugs/issue32959.go | |
parent | a19c0ceda59b2223ca873b61f059c8ccb447fa80 (diff) | |
download | go-git-06ef108cec98b3dfc0fba3f49e733a18eb9badd5.tar.gz |
cmd/compile: fix unsafeValue handles OLSH/ORSH wrong
For OLSH/ORSH, the right node is not a uintptr-typed. However,
unsafeValue still be called recursively for it, causing the
compiler crashes.
To fixing, the right node only needs to be evaluated
for side-effects, so just discard its value.
Fixes #32959
Change-Id: I34d5aa0823a0545f6dad1ec34774235ecf11addc
Reviewed-on: https://go-review.googlesource.com/c/go/+/185039
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test/fixedbugs/issue32959.go')
-rw-r--r-- | test/fixedbugs/issue32959.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/fixedbugs/issue32959.go b/test/fixedbugs/issue32959.go new file mode 100644 index 0000000000..a0dc789a04 --- /dev/null +++ b/test/fixedbugs/issue32959.go @@ -0,0 +1,17 @@ +// compile + +// Copyright 2019 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Test escape analysis with shifting constant + +package main + +import "unsafe" + +func main() { + var l uint64 + var p unsafe.Pointer + _ = unsafe.Pointer(uintptr(p) + (uintptr(l) >> 1)) +} |