aboutsummaryrefslogtreecommitdiff
path: root/libgo/go/runtime/checkptr.go
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-04-06 14:04:45 -0700
committerIan Lance Taylor <iant@golang.org>2020-04-06 16:37:24 -0700
commit52fa80f853c0b0f623ea9e4c7198e324ce44ff30 (patch)
treee2695726e95b7bd125d52b7bdd315cb0028854fa /libgo/go/runtime/checkptr.go
parent749bd22ddc50b5112e5ed506ffef7249bf8e6fb3 (diff)
downloadgcc-52fa80f853c0b0f623ea9e4c7198e324ce44ff30.zip
gcc-52fa80f853c0b0f623ea9e4c7198e324ce44ff30.tar.gz
gcc-52fa80f853c0b0f623ea9e4c7198e324ce44ff30.tar.bz2
libgo: update to almost the 1.14.2 release
Update to edea4a79e8d7dea2456b688f492c8af33d381dc2 which is likely to be approximately the 1.14.2 release. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/227377
Diffstat (limited to 'libgo/go/runtime/checkptr.go')
-rw-r--r--libgo/go/runtime/checkptr.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/go/runtime/checkptr.go b/libgo/go/runtime/checkptr.go
index 974f0a0..d5f116c 100644
--- a/libgo/go/runtime/checkptr.go
+++ b/libgo/go/runtime/checkptr.go
@@ -10,8 +10,10 @@ import "unsafe"
func checkptrAlignment(p unsafe.Pointer, elem *_type, n uintptr) {
// Check that (*[n]elem)(p) is appropriately aligned.
+ // Note that we allow unaligned pointers if the types they point to contain
+ // no pointers themselves. See issue 37298.
// TODO(mdempsky): What about fieldAlign?
- if uintptr(p)&(uintptr(elem.align)-1) != 0 {
+ if elem.ptrdata != 0 && uintptr(p)&(uintptr(elem.align)-1) != 0 {
throw("checkptr: unsafe pointer conversion")
}