diff options
| author | Albert van der Linde <alinde@google.com> | 2020-07-14 07:47:26 +0000 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2020-07-14 12:20:37 +0200 |
| commit | 6f4580264a29fa73097e96b436141a8594b97610 (patch) | |
| tree | 3e184241f624d90f04cffc9d546eee4e03099216 /prog/encoding.go | |
| parent | 230553f68fcaa90508b724edd0dfc806669c1f22 (diff) | |
prog/alloc: align address allocation for aligned[addr]
Calls to alloc didn't respect the alignment attribute. Now
Type.Alignment() is used to ensure each type is correctly
aligned. Existing descriptions with [align[X]] don't have an
issue as they align to small blocks and default align is to
64 bytes. This commits adds support for [align[X]] for an X
larger than 64.
Diffstat (limited to 'prog/encoding.go')
| -rw-r--r-- | prog/encoding.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/prog/encoding.go b/prog/encoding.go index 1f5b2b374..6dd2a2582 100644 --- a/prog/encoding.go +++ b/prog/encoding.go @@ -1017,7 +1017,7 @@ func (p *parser) fixupAutos(prog *Prog) { _ = s case *PtrType: a := arg.(*PointerArg) - a.Address = s.ma.alloc(nil, a.Res.Size()) + a.Address = s.ma.alloc(nil, a.Res.Size(), a.Res.Type().Alignment()) default: panic(fmt.Sprintf("unsupported auto type %T", typ)) } |
