aboutsummaryrefslogtreecommitdiffstats
path: root/prog/rand.go
diff options
context:
space:
mode:
authorAlbert van der Linde <alinde@google.com>2020-07-14 07:47:26 +0000
committerDmitry Vyukov <dvyukov@google.com>2020-07-14 12:20:37 +0200
commit6f4580264a29fa73097e96b436141a8594b97610 (patch)
tree3e184241f624d90f04cffc9d546eee4e03099216 /prog/rand.go
parent230553f68fcaa90508b724edd0dfc806669c1f22 (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/rand.go')
-rw-r--r--prog/rand.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/prog/rand.go b/prog/rand.go
index 5ff448062..4dfff97e5 100644
--- a/prog/rand.go
+++ b/prog/rand.go
@@ -336,7 +336,7 @@ func (r *randGen) randString(s *state, t *BufferType) []byte {
}
func (r *randGen) allocAddr(s *state, typ Type, dir Dir, size uint64, data Arg) *PointerArg {
- return MakePointerArg(typ, dir, s.ma.alloc(r, size), data)
+ return MakePointerArg(typ, dir, s.ma.alloc(r, size, data.Type().Alignment()), data)
}
func (r *randGen) allocVMA(s *state, typ Type, dir Dir, numPages uint64) *PointerArg {