diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-06 15:18:50 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-02-06 15:18:50 +0000 |
commit | c88893a0da8fd01f20b4e254f706f054a72fc435 (patch) | |
tree | fb04c3aa403bdf247afafcc485c9fe87cf71fd3b | |
parent | 43fbc2e9c46ad20a9566cc85f12ac24021f19ad3 (diff) | |
download | gcc-c88893a0da8fd01f20b4e254f706f054a72fc435.zip gcc-c88893a0da8fd01f20b4e254f706f054a72fc435.tar.gz gcc-c88893a0da8fd01f20b4e254f706f054a72fc435.tar.bz2 |
runtime: correct runtime structfield type to match reflect
The offset field in structfield has changed to offsetAnon, and now
requires a shift to get the actual offset value.
Fixes golang/go#23391
Reviewed-on: https://go-review.googlesource.com/92275
From-SVN: r257413
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | libgo/go/runtime/cgocall.go | 2 | ||||
-rw-r--r-- | libgo/go/runtime/type.go | 18 |
3 files changed, 15 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index ba8a8e0..91bebe5 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -c02c71187c9794b50444e2858c582e66a3442ee8 +1927b40e59e7c2067ecb03384b331d1be3cb5eea The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/libgo/go/runtime/cgocall.go b/libgo/go/runtime/cgocall.go index 9d16120..d5794bc 100644 --- a/libgo/go/runtime/cgocall.go +++ b/libgo/go/runtime/cgocall.go @@ -189,7 +189,7 @@ func cgoCheckArg(t *_type, p unsafe.Pointer, indir, top bool, msg string) { return } for _, f := range st.fields { - cgoCheckArg(f.typ, add(p, f.offset), true, top, msg) + cgoCheckArg(f.typ, add(p, f.offset()), true, top, msg) } case kindPtr, kindUnsafePointer: if indir { diff --git a/libgo/go/runtime/type.go b/libgo/go/runtime/type.go index 6788f24..0ec0da4 100644 --- a/libgo/go/runtime/type.go +++ b/libgo/go/runtime/type.go @@ -113,11 +113,19 @@ type ptrtype struct { } type structfield struct { - name *string // nil for embedded fields - pkgPath *string // nil for exported Names; otherwise import path - typ *_type // type of field - tag *string // nil if no tag - offset uintptr // byte offset of field within struct + name *string // nil for embedded fields + pkgPath *string // nil for exported Names; otherwise import path + typ *_type // type of field + tag *string // nil if no tag + offsetAnon uintptr // byte offset of field<<1 | isAnonymous +} + +func (f *structfield) offset() uintptr { + return f.offsetAnon >> 1 +} + +func (f *structfield) anon() bool { + return f.offsetAnon&1 != 0 } type structtype struct { |