diff options
Diffstat (limited to 'src/cmd/compile/internal/types/size.go')
-rw-r--r-- | src/cmd/compile/internal/types/size.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/cmd/compile/internal/types/size.go b/src/cmd/compile/internal/types/size.go index a75429f0ab..ef23cdf5fe 100644 --- a/src/cmd/compile/internal/types/size.go +++ b/src/cmd/compile/internal/types/size.go @@ -163,9 +163,19 @@ func calcStructOffset(errtype *Type, t *Type, o int64, flag int) int64 { if f.Type.Align > 0 { o = Rnd(o, int64(f.Type.Align)) } - if isStruct { // For receiver/args/results, do not set, it depends on ABI + if isStruct { // For receiver/args/results, depends on ABI f.Offset = o } + if f.Nname != nil { + // addrescapes has similar code to update these offsets. + // Usually addrescapes runs after calcStructOffset, + // in which case we could drop this, + // but function closure functions are the exception. + // NOTE(rsc): This comment may be stale. + // It's possible the ordering has changed and this is + // now the common case. I'm not sure. + f.Nname.(VarObject).RecordFrameOffset(o) + } w := f.Type.Width if w < 0 { |