diff options
Diffstat (limited to 'libgo/go/runtime/checkptr.go')
-rw-r--r-- | libgo/go/runtime/checkptr.go | 4 |
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") } |